| from steps import step |
| import subprocess |
| |
| class BuildImage(step.Step): |
| def bitbake(self): |
| """Performs the openbmc build using bitbake""" |
| return "bitbake -k obmc-phosphor-image" |
| |
| def export_gbmc_config(self): |
| """Sets the bitbake environment variable for GBMC_CONFIG""" |
| return f"export GBMC_CONFIG={self.gbmc_config}" |
| |
| def export_gbmc_version(self): |
| """Sets the bitbake environment variable for GBMC_VERSION""" |
| return f"export GBMC_VERSION={self.firmware_version}" |
| |
| def export_bb_env_extrawhite(self): |
| """Adds GBMC_CONFIG and GBMC_VERSION to BB_ENV_EXTRAWHITE whitelist""" |
| return "export BB_ENV_EXTRAWHITE=${BB_ENV_EXTRAWHITE} GBMC_CONFIG GBMC_VERSION" |
| |
| def run_script(self): |
| |
| # command = |
| # """export MACHINE=machine0 && source setup machine0 && umask 002 |
| # && export GBMC_CONFIG=dev && export GBMC_VERSION=x.y.z |
| # && export BB_ENV_EXTRAWHITE=${BB_ENV_EXTRAWHITE} GBMC_CONFIG GBMC_VERSION |
| # && bitbake -k obmc-phosphor-image |
| # """ |
| command = " && ".join([ |
| self.export_machine(), self.source_setup(), self.umask(), self.export_gbmc_config(), |
| self.export_gbmc_version(), self.export_bb_env_extrawhite(), self.bitbake()]) |
| |
| subprocess.run(["bash", "-c", command]) |