diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2016-04-01 00:32:55 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-03 15:51:35 +0100 |
| commit | 1f2f43c5b08a449c963109332ac91653a9f3f5ef (patch) | |
| tree | 94c452b158184d07a5c1e745484a6f9cc71b2109 | |
| parent | bf5852681b9492afbad6f0425ee8a39547070817 (diff) | |
| download | poky-1f2f43c5b08a449c963109332ac91653a9f3f5ef.tar.gz | |
grub-efi.bbclass: use GRUB_ROOT rather than APPEND for root device
Use APPEND for grub's root device may cause confusion, for example, when
building efi + pcbios, there maybe be two root=/dev/ram0, one of them
would be carried to the installed target, and the target would fail to
boot. Use GRUB_ROOT to fix the problem, and remove SYSLINUX_ROOT from
APPEND will fix the problem.
[YOCTO #9354]
(From OE-Core rev: 1f46fe7d501644c83f81dc4cc3310073c804f797)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/grub-efi.bbclass | 10 | ||||
| -rw-r--r-- | meta/classes/syslinux.bbclass | 22 |
2 files changed, 21 insertions, 11 deletions
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass index 3d8ff11ee8..4ce3d2844a 100644 --- a/meta/classes/grub-efi.bbclass +++ b/meta/classes/grub-efi.bbclass | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | # ${APPEND} - an override list of append strings for each label | 14 | # ${APPEND} - an override list of append strings for each label |
| 15 | # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) | 15 | # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) |
| 16 | # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) | 16 | # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) |
| 17 | # ${GRUB_ROOT} - grub's root device. | ||
| 17 | 18 | ||
| 18 | do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy" | 19 | do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy" |
| 19 | do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy" | 20 | do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy" |
| @@ -26,7 +27,8 @@ GRUB_TIMEOUT ?= "10" | |||
| 26 | GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1" | 27 | GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1" |
| 27 | 28 | ||
| 28 | EFIDIR = "/EFI/BOOT" | 29 | EFIDIR = "/EFI/BOOT" |
| 29 | APPEND_prepend = " ${ROOT} " | 30 | GRUB_ROOT ?= "${ROOT}" |
| 31 | APPEND ?= "" | ||
| 30 | 32 | ||
| 31 | # Need UUID utility code. | 33 | # Need UUID utility code. |
| 32 | inherit fs-uuid | 34 | inherit fs-uuid |
| @@ -108,6 +110,10 @@ python build_efi_cfg() { | |||
| 108 | else: | 110 | else: |
| 109 | cfgfile.write('timeout=50\n') | 111 | cfgfile.write('timeout=50\n') |
| 110 | 112 | ||
| 113 | root = d.getVar('GRUB_ROOT', True) | ||
| 114 | if not root: | ||
| 115 | raise bb.build.FuncFailed('GRUB_ROOT not defined') | ||
| 116 | |||
| 111 | if gfxserial == "1": | 117 | if gfxserial == "1": |
| 112 | btypes = [ [ " graphics console", "" ], | 118 | btypes = [ [ " graphics console", "" ], |
| 113 | [ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ] | 119 | [ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ] |
| @@ -131,6 +137,8 @@ python build_efi_cfg() { | |||
| 131 | lb = "install-efi" | 137 | lb = "install-efi" |
| 132 | cfgfile.write('linux /vmlinuz LABEL=%s' % (lb)) | 138 | cfgfile.write('linux /vmlinuz LABEL=%s' % (lb)) |
| 133 | 139 | ||
| 140 | cfgfile.write(' %s' % replace_rootfs_uuid(d, root)) | ||
| 141 | |||
| 134 | append = localdata.getVar('APPEND', True) | 142 | append = localdata.getVar('APPEND', True) |
| 135 | initrd = localdata.getVar('INITRD', True) | 143 | initrd = localdata.getVar('INITRD', True) |
| 136 | 144 | ||
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 7d324c31de..defad73a11 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass | |||
| @@ -33,7 +33,7 @@ AUTO_SYSLINUXMENU ?= "1" | |||
| 33 | SYSLINUX_ROOT ?= "${ROOT}" | 33 | SYSLINUX_ROOT ?= "${ROOT}" |
| 34 | SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" | 34 | SYSLINUX_CFG_VM ?= "${S}/syslinux_vm.cfg" |
| 35 | SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" | 35 | SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg" |
| 36 | APPEND_prepend = " ${SYSLINUX_ROOT} " | 36 | APPEND ?= "" |
| 37 | 37 | ||
| 38 | # Need UUID utility code. | 38 | # Need UUID utility code. |
| 39 | inherit fs-uuid | 39 | inherit fs-uuid |
| @@ -164,6 +164,10 @@ python build_syslinux_cfg () { | |||
| 164 | btypes = [ [ "Graphics console ", syslinux_default_console ], | 164 | btypes = [ [ "Graphics console ", syslinux_default_console ], |
| 165 | [ "Serial console ", syslinux_serial_tty ] ] | 165 | [ "Serial console ", syslinux_serial_tty ] ] |
| 166 | 166 | ||
| 167 | root= d.getVar('SYSLINUX_ROOT', True) | ||
| 168 | if not root: | ||
| 169 | raise bb.build.FuncFailed('SYSLINUX_ROOT not defined') | ||
| 170 | |||
| 167 | for btype in btypes: | 171 | for btype in btypes: |
| 168 | cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label)) | 172 | cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label)) |
| 169 | 173 | ||
| @@ -174,17 +178,15 @@ python build_syslinux_cfg () { | |||
| 174 | append = localdata.getVar('APPEND', True) | 178 | append = localdata.getVar('APPEND', True) |
| 175 | initrd = localdata.getVar('INITRD', True) | 179 | initrd = localdata.getVar('INITRD', True) |
| 176 | 180 | ||
| 177 | if append: | 181 | append = root + " " + append |
| 178 | cfgfile.write('APPEND ') | 182 | cfgfile.write('APPEND ') |
| 179 | 183 | ||
| 180 | if initrd: | 184 | if initrd: |
| 181 | cfgfile.write('initrd=/initrd ') | 185 | cfgfile.write('initrd=/initrd ') |
| 182 | 186 | ||
| 183 | cfgfile.write('LABEL=%s '% (label)) | 187 | cfgfile.write('LABEL=%s '% (label)) |
| 184 | append = replace_rootfs_uuid(d, append) | 188 | append = replace_rootfs_uuid(d, append) |
| 185 | cfgfile.write('%s %s\n' % (append, btype[1])) | 189 | cfgfile.write('%s %s\n' % (append, btype[1])) |
| 186 | else: | ||
| 187 | cfgfile.write('APPEND %s\n' % btype[1]) | ||
| 188 | 190 | ||
| 189 | cfgfile.close() | 191 | cfgfile.close() |
| 190 | } | 192 | } |
