From b9f9710ba4df77e2ef0f06ccb1d2870f626d229e Mon Sep 17 00:00:00 2001 From: Jianxun Zhang Date: Wed, 3 Aug 2016 11:04:21 -0700 Subject: rmc: Don't install boot entries when RMC entries exist RMC installer copies RMC entries after copying default entries. But default entries aren't overwritten when RMC entries have different file names from them, so they will be kept on target after installation. RMC Bootloader skips loading default entries when it can get RMC entries from RMC database file. However, RMC database file isn't deployed onto target in installation by design. As a result, default entries show up along with deployed RMC entries once target reboots after installation. We cannot get rid of these default entries in RMC deployment section because it doesn't know which entry file should be removed. An easier way is not to deploy default entries when any boot entry files assumingly from RMC are already deployed at a later step. Similar logic applies to loader.conf too. Signed-off-by: Jianxun Zhang Reviewed-by: Saul Wold Signed-off-by: Tom Zanussi --- .../initrdscripts/files/init-install-efi.sh | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'common') diff --git a/common/recipes-core/initrdscripts/files/init-install-efi.sh b/common/recipes-core/initrdscripts/files/init-install-efi.sh index 0b2ee46b..71480055 100644 --- a/common/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/common/recipes-core/initrdscripts/files/init-install-efi.sh @@ -208,21 +208,14 @@ fi mount $bootfs /boot echo "Preparing boot partition..." -# RMC deployment -RMC_CMD=/src_root/usr/bin/rmc -RMC_DB=/run/media/$1/rmc.db - EFIDIR="/boot/EFI/BOOT" mkdir -p $EFIDIR - # Copy the efi loader cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR -# We only support gummiboot/systemd-boot. Leave grub-efi not changed. -if [ -d /run/media/$1/loader ]; then - # copy config files for gummiboot - cp -dr /run/media/$1/loader /boot -fi +# RMC deployment +RMC_CMD=/src_root/usr/bin/rmc +RMC_DB=/run/media/$1/rmc.db # We don't want to quit when a step failed. For example, # a file system could not support some operations. @@ -298,9 +291,21 @@ fi if [ -d /run/media/$1/loader ]; then rootuuid=$(blkid -o value -s PARTUUID ${rootfs}) GUMMIBOOT_CFGS="/boot/loader/entries/*.conf" - # delete the install entry - # fixme: If RMC did deploy install.conf at previous steps, it is purged here... - rm -f /boot/loader/entries/install.conf + if [ -d /boot/loader ]; then + # Don't override loader.conf RMC already deployed + if [ ! -f /boot/loader/loader.conf ]; then + cp /run/media/$1/loader/loader.conf /boot/loader/ + fi + # only copy built OE entries when RMC entries don't exist. + if [ ! -d /boot/loader/entries ] || [ ! ls /boot/loader/entries/*.conf &>/dev/null ]; then + cp -dr /run/media/$1/loader/entries /boot/loader + fi + else + # copy config files for gummiboot + cp -dr /run/media/$1/loader /boot + # delete the install entry + rm -f /boot/loader/entries/install.conf + fi # delete the initrd lines sed -i "/initrd /d" $GUMMIBOOT_CFGS # delete any LABEL= strings -- cgit v1.2.3-54-g00ecf