Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] Fixes for grub EFI
@ 2016-04-01  9:14 Robert Yang
  2016-04-01  9:14 ` [PATCH 1/3] init-install.sh: fix disk_size Robert Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Robert Yang @ 2016-04-01  9:14 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 322904f62f11e794543362f04212242567c556a0:

  selftest/signing: Use packagedata to obtain PR value for signing test (2016-03-31 23:55:13 +0100)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/efi
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=19f9e2e1bf005d885453ec2d5ead37de78c6bd0c

Robert Yang (3):
  init-install.sh: fix disk_size
  init-install-efi.sh: remove all root=foo from grub.cfg
  grub-efi.bbclass: don't use APPEND

 meta/classes/grub-efi.bbclass                                | 12 ++++++------
 .../initrdscripts/files/init-install-efi-testfs.sh           |  2 +-
 meta/recipes-core/initrdscripts/files/init-install-efi.sh    |  4 ++--
 meta/recipes-core/initrdscripts/files/init-install.sh        |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.8.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] init-install.sh: fix disk_size
  2016-04-01  9:14 [PATCH 0/3] Fixes for grub EFI Robert Yang
@ 2016-04-01  9:14 ` Robert Yang
  2016-04-01  9:14 ` [PATCH 2/3] init-install-efi.sh: remove all root=foo from grub.cfg Robert Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Robert Yang @ 2016-04-01  9:14 UTC (permalink / raw)
  To: openembedded-core

It mis-matched "SanDisk" or "Disk Flags" before, which caused unexpected
error.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh | 2 +-
 meta/recipes-core/initrdscripts/files/init-install-efi.sh        | 2 +-
 meta/recipes-core/initrdscripts/files/init-install.sh            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
index 7a0b4d4..b562109 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
@@ -69,7 +69,7 @@ umount /dev/${device}* 2> /dev/null || /bin/true
 mkdir -p /tmp
 cat /proc/mounts > /etc/mtab
 
-disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted /dev/${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 testfs_size=$((disk_size*testfs_ratio/100))
 rootfs_size=$((disk_size-boot_size-testfs_size))
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 0443a9d..3531158 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -120,7 +120,7 @@ if [ ! -e /etc/mtab ]; then
     cat /proc/mounts > /etc/mtab
 fi
 
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 swap_size=$((disk_size*swap_ratio/100))
 rootfs_size=$((disk_size-boot_size-swap_size))
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 1925d90..c5623ee 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -116,7 +116,7 @@ if [ ! -L /etc/mtab ]; then
     cat /proc/mounts > /etc/mtab
 fi
 
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
 
-- 
2.8.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] init-install-efi.sh: remove all root=foo from grub.cfg
  2016-04-01  9:14 [PATCH 0/3] Fixes for grub EFI Robert Yang
  2016-04-01  9:14 ` [PATCH 1/3] init-install.sh: fix disk_size Robert Yang
@ 2016-04-01  9:14 ` Robert Yang
  2016-04-01  9:14 ` [PATCH 3/3] grub-efi.bbclass: don't use APPEND Robert Yang
  2016-04-02  6:28 ` [PATCH 0/3] Fixes for grub EFI Robert Yang
  3 siblings, 0 replies; 6+ messages in thread
From: Robert Yang @ 2016-04-01  9:14 UTC (permalink / raw)
  To: openembedded-core

There might be more than one root=/dev/foo in the config file which
would cause unepected errros on the installed target, so remove all of
them.

[YOCTO #9354]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-core/initrdscripts/files/init-install-efi.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 3531158..d58826a 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -217,7 +217,7 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
     # Delete any LABEL= strings
     sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
     # Delete any root= strings
-    sed -i "s/ root=[^ ]*/ /" $GRUBCFG
+    sed -i "s/ root=[^ ]*/ /g" $GRUBCFG
     # Add the root= and other standard boot options
     sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG
 fi
-- 
2.8.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] grub-efi.bbclass: don't use APPEND
  2016-04-01  9:14 [PATCH 0/3] Fixes for grub EFI Robert Yang
  2016-04-01  9:14 ` [PATCH 1/3] init-install.sh: fix disk_size Robert Yang
  2016-04-01  9:14 ` [PATCH 2/3] init-install-efi.sh: remove all root=foo from grub.cfg Robert Yang
@ 2016-04-01  9:14 ` Robert Yang
  2016-04-01 10:01   ` Robert Yang
  2016-04-02  6:28 ` [PATCH 0/3] Fixes for grub EFI Robert Yang
  3 siblings, 1 reply; 6+ messages in thread
From: Robert Yang @ 2016-04-01  9:14 UTC (permalink / raw)
  To: openembedded-core

APPEND is a keyword of syslinux, grub should not use it, use GRUB_ROOT
to instead of it.

[YOCTO #9354]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/grub-efi.bbclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 3d8ff11..f80a3cc 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -11,9 +11,9 @@
 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
 # ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
 # ${LABELS} - a list of targets for the automatic config
-# ${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 +26,7 @@ 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}"
 
 # Need UUID utility code.
 inherit fs-uuid
@@ -131,12 +131,12 @@ python build_efi_cfg() {
                 lb = "install-efi"
             cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
 
-            append = localdata.getVar('APPEND', True)
+            root = localdata.getVar('GRUB_ROOT', True)
             initrd = localdata.getVar('INITRD', True)
 
-            if append:
-                append = replace_rootfs_uuid(d, append)
-                cfgfile.write('%s' % (append))
+            if root:
+                root = replace_rootfs_uuid(d, root)
+                cfgfile.write(' %s' % (root))
             cfgfile.write(' %s' % btype[1])
             cfgfile.write('\n')
 
-- 
2.8.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] grub-efi.bbclass: don't use APPEND
  2016-04-01  9:14 ` [PATCH 3/3] grub-efi.bbclass: don't use APPEND Robert Yang
@ 2016-04-01 10:01   ` Robert Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Yang @ 2016-04-01 10:01 UTC (permalink / raw)
  To: openembedded-core


For patch 3/3, RP said that changing APPEND may break some other BSP
layers, I will update this patch.

// Robert

On 04/01/2016 05:14 PM, Robert Yang wrote:
> APPEND is a keyword of syslinux, grub should not use it, use GRUB_ROOT
> to instead of it.
>
> [YOCTO #9354]
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>   meta/classes/grub-efi.bbclass | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
> index 3d8ff11..f80a3cc 100644
> --- a/meta/classes/grub-efi.bbclass
> +++ b/meta/classes/grub-efi.bbclass
> @@ -11,9 +11,9 @@
>   # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
>   # ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
>   # ${LABELS} - a list of targets for the automatic config
> -# ${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 +26,7 @@ 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}"
>
>   # Need UUID utility code.
>   inherit fs-uuid
> @@ -131,12 +131,12 @@ python build_efi_cfg() {
>                   lb = "install-efi"
>               cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
>
> -            append = localdata.getVar('APPEND', True)
> +            root = localdata.getVar('GRUB_ROOT', True)
>               initrd = localdata.getVar('INITRD', True)
>
> -            if append:
> -                append = replace_rootfs_uuid(d, append)
> -                cfgfile.write('%s' % (append))
> +            if root:
> +                root = replace_rootfs_uuid(d, root)
> +                cfgfile.write(' %s' % (root))
>               cfgfile.write(' %s' % btype[1])
>               cfgfile.write('\n')
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] Fixes for grub EFI
  2016-04-01  9:14 [PATCH 0/3] Fixes for grub EFI Robert Yang
                   ` (2 preceding siblings ...)
  2016-04-01  9:14 ` [PATCH 3/3] grub-efi.bbclass: don't use APPEND Robert Yang
@ 2016-04-02  6:28 ` Robert Yang
  3 siblings, 0 replies; 6+ messages in thread
From: Robert Yang @ 2016-04-02  6:28 UTC (permalink / raw)
  To: openembedded-core


Hello,

I updated patch 3/3 in the repo, now APPEND is stilled kept for
syslinux and grub-efi.

Here are the patches:

git://git.openembedded.org/openembedded-core-contrib rbt/efi
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/efi

Patch 1 and 2 are the same, here is patch 3:

commit 4d56b6768748368a1a792c0d9e29ddfa2f87d2aa
Author: Robert Yang <liezhi.yang@windriver.com>
Date:   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@windriver.com>

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()
  }


// Robert

On 04/01/2016 05:14 PM, Robert Yang wrote:
> The following changes since commit 322904f62f11e794543362f04212242567c556a0:
>
>    selftest/signing: Use packagedata to obtain PR value for signing test (2016-03-31 23:55:13 +0100)
>
> are available in the git repository at:
>
>    git://git.openembedded.org/openembedded-core-contrib rbt/efi
>    http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=19f9e2e1bf005d885453ec2d5ead37de78c6bd0c
>
> Robert Yang (3):
>    init-install.sh: fix disk_size
>    init-install-efi.sh: remove all root=foo from grub.cfg
>    grub-efi.bbclass: don't use APPEND
>
>   meta/classes/grub-efi.bbclass                                | 12 ++++++------
>   .../initrdscripts/files/init-install-efi-testfs.sh           |  2 +-
>   meta/recipes-core/initrdscripts/files/init-install-efi.sh    |  4 ++--
>   meta/recipes-core/initrdscripts/files/init-install.sh        |  2 +-
>   4 files changed, 10 insertions(+), 10 deletions(-)
>


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-02  6:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01  9:14 [PATCH 0/3] Fixes for grub EFI Robert Yang
2016-04-01  9:14 ` [PATCH 1/3] init-install.sh: fix disk_size Robert Yang
2016-04-01  9:14 ` [PATCH 2/3] init-install-efi.sh: remove all root=foo from grub.cfg Robert Yang
2016-04-01  9:14 ` [PATCH 3/3] grub-efi.bbclass: don't use APPEND Robert Yang
2016-04-01 10:01   ` Robert Yang
2016-04-02  6:28 ` [PATCH 0/3] Fixes for grub EFI Robert Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox