-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
acrn-sblimage: add custom image type to inject ACRN SBL boot image #182
Conversation
Thanks Toshi for the patch. |
classes/acrn-sblimage.bbclass
Outdated
MB_MC_DEPENDENCY ?= "" | ||
MB_ACRN_BINARY ?= "${TMPDIR}/deploy/images/${MACHINE}/acrn.32.out" | ||
MB_ACRN_CMDLINE ?= "" | ||
MB_ACRN_MODULES ?= "${TOPDIR}/conf/linux.txt;${TMPDIR}/deploy/images/${MACHINE}/${KERNEL_IMAGETYPE}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably use DEPLOY_DIR_IMAGE
instead of ${TMPDIR}/deploy/images/${MACHINE}
in case someone has overriden that. Same for MB_ACRN_BINARY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. thanks
classes/acrn-sblimage.bbclass
Outdated
|
||
mbAcrnBinaryDeployDir = d.getVar('MB_ACRN_BINARY').lstrip().rstrip() | ||
if not os.path.isfile(mbAcrnBinaryDeployDir): | ||
bb.error("acrn %s not found!" % mbAcrnBinaryDeployDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it help if we can give some helpful hints to the user when this happens? When can this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we expect the task to fail here? bb.error doesn't cause the task to fail I think. Perhaps raise an exception or check if bb.fatal make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the task should fail. I will use bb.fatal. In normal case this never happens. Because if ACRN hypervisor build failed, bitbake will not reach at here. It could happen only when user moved acrn.32.out file like below.
$ bitbake mc:sos:acrn-hypervisor
$ rm master-acrn-sos/deploy/images/intel-corei7-64/acrn.32.out
$ bitbake mc:sos:acrn-image-minimal
In this case bitbake will run the do_acrn_sblimage() task because it is not aware of that acrn.32.out is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error message will show file path which is not available. for example,
acrn master-acrn-sos/deploy/images/intel-corei7-64/acrn.32.out not found!
It should be enough hint for users to understand the failure reason.
classes/acrn-sblimage.bbclass
Outdated
bb.error("module %s not found!" % mbAcrnBinaryDeployDirPairMods[0]) | ||
|
||
if not os.path.isfile(mbAcrnBinaryDeployDirPairMods[1]): | ||
bb.error("module %s not found!" % mbAcrnBinaryDeployDirPairMods[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment, I don't know much about the internals ... when can this happen? Is there any helpful hint that we can provide here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some module files such as Zephyr OS image are supposed to be provided by users. Because Yocto cannot build Zephyr. These errors can happen when the task could not find files specified by users. Again it will output file path which the task could not find as a hint of failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zephyr can be build using Yocto. We have meta-zephyr layer.
http://git.yoctoproject.org/cgit/cgit.cgi/meta-zephyr
Previously I created a PR to build zephyr as UOS. But need to rebase that PR.
#39
classes/acrn-sblimage.bbclass
Outdated
for multibootPackageMcDependency in multibootPackageMcDependencyList: | ||
if multibootPackageMcDependency: | ||
mcdependency = "multiconfig::%s" % (multibootPackageMcDependency) | ||
print("MultibootMcDependency: %s" % (mcdependency)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some of these prints should be replaced by bb.debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
okay |
classes/acrn-sblimage.bbclass
Outdated
|
||
bb.debug(1, "genContainerCmd: %s" % (genContainerCmd)) | ||
os.system("%s" % (genContainerCmd)) | ||
os.system("install -d %s/boot; install -m 644 %s/%s %s/boot" % (d.getVar('IMAGE_ROOTFS'), d.getVar('WORKDIR'), d.getVar('SBLIMAGE_NAME'), d.getVar('IMAGE_ROOTFS'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I had not noticed this in the first revision. I think these two calls should be replaced by subprocess.
add the image class to generate the multiboot compliant container images which stitch ACRN Hypervisor and Operating Systems to boot with Slim Bootloader. Signed-off-by: Schmidt, Michael <[email protected]> Signed-off-by: Nishioka, Toshiki <[email protected]>
Signed-off-by: Nishioka, Toshiki <[email protected]>
add the image class to generate the multiboot compliant container
images which stitch ACRN Hypervisor and Operating Systems to boot with
Slim Bootloader.
Usage: Example for the ACRN hybrid scenario
meta-intel with commit#180027 is required.
http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/commit/?id=180027
add sos to BBMULTICONFIG in conf/local.conf
BBMULTICONFIG = "sos uos"
enable the SBL containerization feature for sos in conf/multiconfig/sos.conf
TMPDIR = "${TOPDIR}/master-acrn-sos"
DISTRO = "acrn-demo-sos"
ACRN_BOARD = "ehl-crb-b"
ACRN_SCENARIO = "hybrid"
IMAGE_CLASSES_append = " acrn-sblimage"
MB_ACRN_MODULES = "
${TOPDIR}/conf/zephyr.txt;${TOPDIR}/conf/zephyr.bin
${TOPDIR}/conf/linux.txt;${TMPDIR}/deploy/images/${MACHINE}/${KERNEL_IMAGETYPE}
"
build$ echo Linux_bzImage > conf/linux.txt
build$ echo Zephyr_RawImage > conf/zephyr.txt
Note: zephyr.bin is supposed to be built outside of yocto
build$ python $(SBL_ROOT)/BootloaderCorePkg/Tools/GenerateKeys.py -k cert
build$ cp cert/OS1_TestKey_Priv_RSA2048.pem cert/TestSigningPrivateKey.pem
ref: https://slimbootloader.github.io/getting-started/build-host-setup.html#sbl-keys
build SOS image
build$ bitbake mc:sos:acrn-image-minimal
confirm the sbl_os container file has been deployed in the generated wic image
build$ sudo losetup -Pf master-acrn-sos/deploy/images/intel-corei7-64/acrn-image-minimal-intel-corei7-64.wic.acrn
build$ sudo mount /dev/loop0p2 /mnt/
build$ ls /mnt/boot/
bzImage bzImage-5.4.52-linux-intel-acrn-sos EFI loader sbl_os
Signed-off-by: Schmidt, Michael [email protected]
Signed-off-by: Nishioka, Toshiki [email protected]