diff options
| author | Hongxu Jia <hongxu.jia@windriver.com> | 2013-11-11 19:56:54 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-20 14:03:23 +0000 |
| commit | 943f4c161ca50df6c84f8882aa39113c05099e15 (patch) | |
| tree | 365df30b922c84bf27dc696500ae7f015d25d648 | |
| parent | dc80eea725906f394469b867edc1a8c72be87ad8 (diff) | |
| download | poky-943f4c161ca50df6c84f8882aa39113c05099e15.tar.gz | |
kernel-grub.bbclass: support /boot area within root partition
Previously, it supported the situation that /boot area with separate boot
partition:
...
menuentry "Update bzImage-3.10.10-WR6.0.0.0_standard-3.10" {
set root=(hd0,1)
linux /bzImage-3.10.10-WR6.0.0.0_standard root=/dev/sdb1 rw ip=dhcp
}
...
But didn't consider the situation that /boot within root partition:
...
menuentry "Update bzImage-3.10.10-WR6.0.0.0_standard-3.10" {
set root=(hd0,1)
linux /boot/bzImage-3.10.10-WR6.0.0.0_standard root=/dev/sdb1 rw ip=dhcp
}
...
This fix supported them both.
[YOCTO #5514]
(From OE-Core rev: 53d342db9f9995564573715f28c3e4c9c8c68bf9)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/kernel-grub.bbclass | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/meta/classes/kernel-grub.bbclass b/meta/classes/kernel-grub.bbclass index 70564f010a..85721ffd70 100644 --- a/meta/classes/kernel-grub.bbclass +++ b/meta/classes/kernel-grub.bbclass | |||
| @@ -40,10 +40,11 @@ pkg_preinst_kernel-image_append () { | |||
| 40 | pkg_postinst_kernel-image_prepend () { | 40 | pkg_postinst_kernel-image_prepend () { |
| 41 | get_new_grub_cfg() { | 41 | get_new_grub_cfg() { |
| 42 | grubcfg="$1" | 42 | grubcfg="$1" |
| 43 | old_image="$2" | ||
| 43 | title="Update ${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}" | 44 | title="Update ${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}" |
| 44 | if [ "${grubcfg##*/}" = "grub.cfg" ]; then | 45 | if [ "${grubcfg##*/}" = "grub.cfg" ]; then |
| 45 | rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \ | 46 | rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \ |
| 46 | sed "s# *linux \+[^ ]\+ \+root=# linux /${KERNEL_IMAGETYPE}-${KERNEL_VERSION} root=#"` | 47 | sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"` |
| 47 | 48 | ||
| 48 | echo "menuentry \"$title\" {" | 49 | echo "menuentry \"$title\" {" |
| 49 | echo " set root=(hd0,1)" | 50 | echo " set root=(hd0,1)" |
| @@ -51,7 +52,7 @@ pkg_postinst_kernel-image_prepend () { | |||
| 51 | echo "}" | 52 | echo "}" |
| 52 | elif [ "${grubcfg##*/}" = "menu.list" ]; then | 53 | elif [ "${grubcfg##*/}" = "menu.list" ]; then |
| 53 | rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \ | 54 | rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \ |
| 54 | sed "s#kernel \+[^ ]\+ \+root=#kernel /${KERNEL_IMAGETYPE}-${KERNEL_VERSION} root=#"` | 55 | sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"` |
| 55 | 56 | ||
| 56 | echo "default 0" | 57 | echo "default 0" |
| 57 | echo "timeout 30" | 58 | echo "timeout 30" |
| @@ -79,9 +80,9 @@ pkg_postinst_kernel-image_prepend () { | |||
| 79 | fi | 80 | fi |
| 80 | 81 | ||
| 81 | # Don't update grubcfg at first install while old bzImage doesn't exist. | 82 | # Don't update grubcfg at first install while old bzImage doesn't exist. |
| 82 | if [ -f "$D/boot/$old_image" ]; then | 83 | if [ -f "$D/boot/${old_image##*/}" ]; then |
| 83 | grubcfgtmp="$grubcfg.tmp" | 84 | grubcfgtmp="$grubcfg.tmp" |
| 84 | get_new_grub_cfg "$grubcfg" > $grubcfgtmp | 85 | get_new_grub_cfg "$grubcfg" "$old_image" > $grubcfgtmp |
| 85 | get_old_grub_cfg "$grubcfg" >> $grubcfgtmp | 86 | get_old_grub_cfg "$grubcfg" >> $grubcfgtmp |
| 86 | mv $grubcfgtmp $grubcfg | 87 | mv $grubcfgtmp $grubcfg |
| 87 | echo "Caution! Update kernel may affect kernel-module!" | 88 | echo "Caution! Update kernel may affect kernel-module!" |
