initramfs-live-install: avoid using grub.d/40_custom

We have this in recipes-bsp/grub/grub/40_custom:

[snip]
menuentry "Linux" {
    set root=(hd0,1)
    linux /vmlinuz root=__ROOTFS__ rw __CONSOLE__ __VIDEO_MODE__ __VGA_MODE__ quiet
}
[snip]

These lines are only for initrdscripts/files/init-install.sh, the side
effect is that it would make the target's grub-mkconfig doesn't work
well since the 40_custom will be installed to /etc/grub.d/40_custom, the
grub-mkconfig will run the 40_custom, and there will always be a
'menuentry "Linux"' menu in grub.cfg no matter it is valid or not, we
can do this in init-install.sh rather than grub to fix the problem,
which is also much simpler.

(From OE-Core rev: 8ae89d08454c11035eb2826a06e2243c9f2568b4)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2014-05-20 10:49:47 +08:00
committed by Richard Purdie
parent ab332098cc
commit 45bbe3528e

View File

@@ -168,17 +168,16 @@ umount /src_root
# Handling of the target boot partition # Handling of the target boot partition
mount $bootfs /boot mount $bootfs /boot
echo "Preparing boot partition..." echo "Preparing boot partition..."
if [ -f /etc/grub.d/40_custom ] ; then if [ -f /etc/grub.d/00_header ] ; then
echo "Preparing custom grub2 menu..." echo "Preparing custom grub2 menu..."
GRUBCFG="/boot/grub/grub.cfg" GRUBCFG="/boot/grub/grub.cfg"
mkdir -p $(dirname $GRUBCFG) mkdir -p $(dirname $GRUBCFG)
cp /etc/grub.d/40_custom $GRUBCFG cat >$GRUBCFG <<_EOF
sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG menuentry "Linux" {
sed -i "s/__VIDEO_MODE__/$3/g" $GRUBCFG set root=(hd0,1)
sed -i "s/__VGA_MODE__/$4/g" $GRUBCFG linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
sed -i "s/__CONSOLE__/$5/g" $GRUBCFG }
sed -i "/#/d" $GRUBCFG _EOF
sed -i "/exec tail/d" $GRUBCFG
chmod 0444 $GRUBCFG chmod 0444 $GRUBCFG
fi fi
grub-install /dev/${device} grub-install /dev/${device}