[oe-commits] [openembedded-core] 01/16: grub-efi.bbclass: use GRUB_ROOT rather than APPEND for root device

git at git.openembedded.org git at git.openembedded.org
Sat Apr 2 16:27:07 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 02500b1a790edf18b34579af32b5fb6ac33bd25b
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Fri Apr 1 00:32:55 2016 -0700

    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]
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/grub-efi.bbclass | 10 +++++++++-
 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 3d8ff11..4ce3d28 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -14,6 +14,7 @@
 # ${APPEND} - an override list of append strings for each label
 # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
 # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
+# ${GRUB_ROOT} - grub's root device.
 
 do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
 do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy"
@@ -26,7 +27,8 @@ GRUB_TIMEOUT ?= "10"
 GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
 
 EFIDIR = "/EFI/BOOT"
-APPEND_prepend = " ${ROOT} "
+GRUB_ROOT ?= "${ROOT}"
+APPEND ?= ""
 
 # Need UUID utility code.
 inherit fs-uuid
@@ -108,6 +110,10 @@ python build_efi_cfg() {
     else:
         cfgfile.write('timeout=50\n')
 
+    root = d.getVar('GRUB_ROOT', True)
+    if not root:
+        raise bb.build.FuncFailed('GRUB_ROOT not defined')
+
     if gfxserial == "1":
         btypes = [ [ " graphics console", "" ],
             [ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ]
@@ -131,6 +137,8 @@ python build_efi_cfg() {
                 lb = "install-efi"
             cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
 
+            cfgfile.write(' %s' % replace_rootfs_uuid(d, root))
+
             append = localdata.getVar('APPEND', True)
             initrd = localdata.getVar('INITRD', True)
 
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 7d324c3..defad73 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -33,7 +33,7 @@ AUTO_SYSLINUXMENU ?= "1"
 SYSLINUX_ROOT ?= "${ROOT}"
 SYSLINUX_CFG_VM  ?= "${S}/syslinux_vm.cfg"
 SYSLINUX_CFG_LIVE ?= "${S}/syslinux_live.cfg"
-APPEND_prepend = " ${SYSLINUX_ROOT} "
+APPEND ?= ""
 
 # Need UUID utility code.
 inherit fs-uuid
@@ -164,6 +164,10 @@ python build_syslinux_cfg () {
             btypes = [ [ "Graphics console ", syslinux_default_console  ],
                 [ "Serial console ", syslinux_serial_tty ] ]
 
+        root= d.getVar('SYSLINUX_ROOT', True)
+        if not root:
+            raise bb.build.FuncFailed('SYSLINUX_ROOT not defined')
+
         for btype in btypes:
             cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label))
 
@@ -174,17 +178,15 @@ python build_syslinux_cfg () {
             append = localdata.getVar('APPEND', True)
             initrd = localdata.getVar('INITRD', True)
 
-            if append:
-                cfgfile.write('APPEND ')
+            append = root + " " + append
+            cfgfile.write('APPEND ')
 
-                if initrd:
-                    cfgfile.write('initrd=/initrd ')
+            if initrd:
+                cfgfile.write('initrd=/initrd ')
 
-                cfgfile.write('LABEL=%s '% (label))
-                append = replace_rootfs_uuid(d, append)
-                cfgfile.write('%s %s\n' % (append, btype[1]))
-            else:
-                cfgfile.write('APPEND %s\n' % btype[1])
+            cfgfile.write('LABEL=%s '% (label))
+            append = replace_rootfs_uuid(d, append)
+            cfgfile.write('%s %s\n' % (append, btype[1]))
 
     cfgfile.close()
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list