Skip to content
Snippets Groups Projects
Commit 705ec950 authored by Kareem Zarka's avatar Kareem Zarka
Browse files

fuse grub.cfg into grub-efi binary


Signed-off-by: default avatarKareem Zarka <kareem.zarka@huawei.com>
parent a845bf55
No related branches found
No related tags found
No related merge requests found
...@@ -21,3 +21,22 @@ GRUB_BUILDIN:append = " squash4 halt echo" ...@@ -21,3 +21,22 @@ GRUB_BUILDIN:append = " squash4 halt echo"
# grub supports this arch. It doesn't support hardfp configuration that can't # grub supports this arch. It doesn't support hardfp configuration that can't
# be forced into softfp with a compiler flag. qemuarm-efi defaults to softfp. # be forced into softfp with a compiler flag. qemuarm-efi defaults to softfp.
COMPATIBLE_HOST:qemuarm-efi = 'arm.*-(linux.*|freebsd.*)' COMPATIBLE_HOST:qemuarm-efi = 'arm.*-(linux.*|freebsd.*)'
# depending on oniro-grub-bootconf:do_deploy in order to obtaing grub.cfg
do_mkimage_grub-efi[depends] += "oniro-grub-bootconf:do_deploy"
inherit deploy
do_mkimage:append() {
cd ${B}
GRUB_MKIMAGE_MODULES="${GRUB_BUILDIN}"
# If 'all' is included in GRUB_BUILDIN we will include all available grub2 modules
if [ "${@ bb.utils.contains('GRUB_BUILDIN', 'all', 'True', 'False', d)}" = "True" ]; then
bbdebug 1 "Including all available modules"
# Get the list of all .mod files in grub-core build directory
GRUB_MKIMAGE_MODULES=$(find ${B}/grub-core/ -type f -name "*.mod" -exec basename {} .mod \;)
fi
# embedding the final grub.cfg that was installed by oniro-grub-bootconf into deploydir
grub-mkimage -v -c ${DEPLOY_DIR}/images/${MACHINE}/grub.cfg -p ${EFIDIR} -d ./grub-core/ \
-O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \
${GRUB_MKIMAGE_MODULES}
}
\ No newline at end of file
...@@ -29,25 +29,23 @@ S = "${WORKDIR}" ...@@ -29,25 +29,23 @@ S = "${WORKDIR}"
do_install() { do_install() {
# Install the boot assets into the rootfs. Those can be used to handle boot # Install the boot assets into the rootfs. Those can be used to handle boot
# asset updates by SysOTA later on. Note that external grub.cfg is # asset updates by SysOTA later on.
# temporary. It must be merged into the grub binary after a period of
# testing.
install -d ${D}${EFI_FILES_PATH} install -d ${D}${EFI_FILES_PATH}
install -m 644 grub.cfg ${D}${EFI_FILES_PATH}/grub.cfg
sed -i "s/@KERNEL_IMAGETYPE@/${KERNEL_IMAGETYPE}/g" ${D}${EFI_FILES_PATH}/grub.cfg
baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
ttydev=`echo "${SERIAL_CONSOLES}" | sed -e 's/^[0-9]*\;//' -e 's/ .*//'`
sed -i "s/@SERIAL_CONSOLES@/${ttydev},${baudrate}/g" ${D}${EFI_FILES_PATH}/grub.cfg
sed -i "s,@RAUC_SLOT_A@,${RAUC_SLOT_A},g" ${D}${EFI_FILES_PATH}/grub.cfg
sed -i "s,@RAUC_SLOT_B@,${RAUC_SLOT_B},g" ${D}${EFI_FILES_PATH}/grub.cfg
sed -i "s,@WIC_BOOTLOADER_TIMEOUT@,${WIC_BOOTLOADER_TIMEOUT},g" ${D}${EFI_FILES_PATH}/grub.cfg
install -m 644 grubenv ${D}${EFI_FILES_PATH}/grubenv install -m 644 grubenv ${D}${EFI_FILES_PATH}/grubenv
} }
do_deploy() { do_deploy() {
#expanding the variables..
sed -i "s/@KERNEL_IMAGETYPE@/${KERNEL_IMAGETYPE}/g" ${WORKDIR}/grub.cfg
baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
ttydev=`echo "${SERIAL_CONSOLES}" | sed -e 's/^[0-9]*\;//' -e 's/ .*//'`
sed -i "s/@SERIAL_CONSOLES@/${ttydev},${baudrate}/g" ${WORKDIR}/grub.cfg
sed -i "s,@RAUC_SLOT_A@,${RAUC_SLOT_A},g" ${WORKDIR}/grub.cfg
sed -i "s,@RAUC_SLOT_B@,${RAUC_SLOT_B},g" ${WORKDIR}/grub.cfg
sed -i "s,@WIC_BOOTLOADER_TIMEOUT@,${WIC_BOOTLOADER_TIMEOUT},g" ${WORKDIR}/grub.cfg
# Install the boot assets into DEPLOYDIR. The deploy bbclass # Install the boot assets into DEPLOYDIR. The deploy bbclass
# eventually copies those into the boot partition. # eventually copies those into the boot partition.
install -m 644 ${D}${EFI_FILES_PATH}/grub.cfg ${DEPLOYDIR} install -m 644 ${WORKDIR}/grub.cfg ${DEPLOYDIR}
# Unlike grub.cfg, nothing installs this file to the boot partition # Unlike grub.cfg, nothing installs this file to the boot partition
# automatically. It is handled by extending IMAGE_EFI_BOOT_FILES from # automatically. It is handled by extending IMAGE_EFI_BOOT_FILES from
# conf/distro/oniro-linux.conf. # conf/distro/oniro-linux.conf.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment