mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
initramfs-live-install: add support for grub2
grub2 needs a different set of install steps from grub 0.97. This adds them to init-install.sh and adds an install-time check that determines which version is being used and which steps to use depending on the version of grub selected. (From OE-Core rev: c67d03eb3684acab89e5972609e397087727e74e) Signed-off-by: Tom Zanussi <tom.zanussi@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
978f48b7e2
commit
bcd1bca880
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# Copyright (C) 2008 Intel
|
# Copyright (C) 2008-2011 Intel
|
||||||
#
|
#
|
||||||
# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
|
# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
|
||||||
#
|
#
|
||||||
@@ -126,6 +126,7 @@ mkswap $swap
|
|||||||
|
|
||||||
mkdir /ssd
|
mkdir /ssd
|
||||||
mkdir /rootmnt
|
mkdir /rootmnt
|
||||||
|
mkdir /bootmnt
|
||||||
|
|
||||||
mount $rootfs /ssd
|
mount $rootfs /ssd
|
||||||
mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
|
mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
|
||||||
@@ -142,6 +143,16 @@ if [ -d /ssd/etc/ ] ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /ssd/etc/grub.d/40_custom ] ; then
|
||||||
|
echo "Preparing custom grub2 menu..."
|
||||||
|
sed -i "s@__ROOTFS__@$rootfs@g" /ssd/etc/grub.d/40_custom
|
||||||
|
sed -i "s/__VIDEO_MODE__/$3/g" /ssd/etc/grub.d/40_custom
|
||||||
|
sed -i "s/__VGA_MODE__/$4/g" /ssd/etc/grub.d/40_custom
|
||||||
|
mount $bootfs /bootmnt
|
||||||
|
cp /ssd/etc/grub.d/40_custom /bootmnt/40_custom
|
||||||
|
umount /bootmnt
|
||||||
|
fi
|
||||||
|
|
||||||
umount /ssd
|
umount /ssd
|
||||||
umount /rootmnt
|
umount /rootmnt
|
||||||
|
|
||||||
@@ -151,11 +162,19 @@ grub-install --root-directory=/ssd /dev/${device}
|
|||||||
|
|
||||||
echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
|
echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
|
||||||
|
|
||||||
echo "default 0" > /ssd/boot/grub/menu.lst
|
if [ -f /ssd/40_custom ] ; then
|
||||||
echo "timeout 30" >> /ssd/boot/grub/menu.lst
|
mv /ssd/40_custom /ssd/boot/grub/grub.cfg
|
||||||
echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst
|
sed -i "/#/d" /ssd/boot/grub/grub.cfg
|
||||||
echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst
|
sed -i "/exec tail/d" /ssd/boot/grub/grub.cfg
|
||||||
echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst
|
chmod 0444 /ssd/boot/grub/grub.cfg
|
||||||
|
else
|
||||||
|
echo "Preparing custom grub menu..."
|
||||||
|
echo "default 0" > /ssd/boot/grub/menu.lst
|
||||||
|
echo "timeout 30" >> /ssd/boot/grub/menu.lst
|
||||||
|
echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst
|
||||||
|
echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst
|
||||||
|
echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst
|
||||||
|
fi
|
||||||
|
|
||||||
cp /media/$1/vmlinuz /ssd/boot/
|
cp /media/$1/vmlinuz /ssd/boot/
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
DESCRIPTION = "A live image init script"
|
DESCRIPTION = "A live image init script for grub"
|
||||||
LICENSE = "MIT"
|
LICENSE = "MIT"
|
||||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||||
SRC_URI = "file://init-install.sh"
|
SRC_URI = "file://init-install.sh"
|
||||||
|
|
||||||
PR = "r4"
|
PR = "r5"
|
||||||
|
|
||||||
RDEPENDS="grub parted e2fsprogs-mke2fs"
|
RDEPENDS="grub parted e2fsprogs-mke2fs"
|
||||||
|
|
||||||
@@ -19,6 +19,4 @@ INHIBIT_DEFAULT_DEPS = "1"
|
|||||||
|
|
||||||
FILES_${PN} = " /install.sh "
|
FILES_${PN} = " /install.sh "
|
||||||
|
|
||||||
# Alternatives to grub need adding for other arch support
|
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
|
||||||
# consistent with grub 0.97
|
|
||||||
COMPATIBLE_HOST = "i.86.*-linux"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user