Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 2/2] initramfs-live-install: add support for grub2
@ 2011-09-14 16:12 Tom Zanussi
  2011-09-14 17:03 ` Otavio Salvador
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Zanussi @ 2011-09-14 16:12 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
 .../initrdscripts/files/init-install.sh            |   31 ++++++++++++++++----
 .../initrdscripts/initramfs-live-install_1.0.bb    |    8 ++---
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 5e6b81c..dceb2a4 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 #
-# Copyright (C) 2008 Intel
+# Copyright (C) 2011 Intel
 #
 # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
 #
@@ -126,6 +126,7 @@ mkswap $swap
 
 mkdir /ssd
 mkdir /rootmnt
+mkdir /bootmnt
 
 mount $rootfs /ssd
 mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
@@ -142,6 +143,16 @@ if [ -d /ssd/etc/ ] ; then
     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 /rootmnt
 
@@ -151,11 +162,19 @@ grub-install --root-directory=/ssd /dev/${device}
 
 echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
 
-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
+if [ -f /ssd/40_custom ] ; then
+    mv /ssd/40_custom /ssd/boot/grub/grub.cfg
+    sed -i "/#/d" /ssd/boot/grub/grub.cfg
+    sed -i "/exec tail/d" /ssd/boot/grub/grub.cfg
+    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/
 
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 0eeabf1..619b16c 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -1,9 +1,9 @@
-DESCRIPTION = "A live image init script"
+DESCRIPTION = "A live image init script for grub"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 SRC_URI = "file://init-install.sh"
 
-PR = "r4"
+PR = "r5"
 
 RDEPENDS="grub parted e2fsprogs-mke2fs"
 
@@ -19,6 +19,4 @@ INHIBIT_DEFAULT_DEPS = "1"
 
 FILES_${PN} = " /install.sh "
 
-# Alternatives to grub need adding for other arch support
-# consistent with grub 0.97
-COMPATIBLE_HOST = "i.86.*-linux"
+COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
-- 
1.7.0.4






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

* Re: [PATCH 2/2] initramfs-live-install: add support for grub2
  2011-09-14 16:12 Tom Zanussi
@ 2011-09-14 17:03 ` Otavio Salvador
  0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2011-09-14 17:03 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: openembedded-core

On Wed, Sep 14, 2011 at 13:12, Tom Zanussi <tom.zanussi@intel.com> wrote:
...
> --- a/meta/recipes-core/initrdscripts/files/init-install.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install.sh
> @@ -1,6 +1,6 @@
>  #!/bin/sh -e
>  #
> -# Copyright (C) 2008 Intel
> +# Copyright (C) 2011 Intel

This ought to be 2008, 2011 or 2008-2011.

Besides that, ack.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



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

* [PATCH 2/2] initramfs-live-install: add support for grub2
@ 2011-09-14 18:01 Tom Zanussi
  2011-09-14 18:08 ` Otavio Salvador
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Zanussi @ 2011-09-14 18:01 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

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.

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
 .../initrdscripts/files/init-install.sh            |   31 ++++++++++++++++----
 .../initrdscripts/initramfs-live-install_1.0.bb    |    8 ++---
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 5e6b81c..fb6cea8 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 #
-# Copyright (C) 2008 Intel
+# Copyright (C) 2008-2011 Intel
 #
 # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
 #
@@ -126,6 +126,7 @@ mkswap $swap
 
 mkdir /ssd
 mkdir /rootmnt
+mkdir /bootmnt
 
 mount $rootfs /ssd
 mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
@@ -142,6 +143,16 @@ if [ -d /ssd/etc/ ] ; then
     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 /rootmnt
 
@@ -151,11 +162,19 @@ grub-install --root-directory=/ssd /dev/${device}
 
 echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
 
-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
+if [ -f /ssd/40_custom ] ; then
+    mv /ssd/40_custom /ssd/boot/grub/grub.cfg
+    sed -i "/#/d" /ssd/boot/grub/grub.cfg
+    sed -i "/exec tail/d" /ssd/boot/grub/grub.cfg
+    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/
 
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 0eeabf1..619b16c 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -1,9 +1,9 @@
-DESCRIPTION = "A live image init script"
+DESCRIPTION = "A live image init script for grub"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 SRC_URI = "file://init-install.sh"
 
-PR = "r4"
+PR = "r5"
 
 RDEPENDS="grub parted e2fsprogs-mke2fs"
 
@@ -19,6 +19,4 @@ INHIBIT_DEFAULT_DEPS = "1"
 
 FILES_${PN} = " /install.sh "
 
-# Alternatives to grub need adding for other arch support
-# consistent with grub 0.97
-COMPATIBLE_HOST = "i.86.*-linux"
+COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
-- 
1.7.0.4






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

* Re: [PATCH 2/2] initramfs-live-install: add support for grub2
  2011-09-14 18:01 [PATCH 2/2] initramfs-live-install: add support for grub2 Tom Zanussi
@ 2011-09-14 18:08 ` Otavio Salvador
  0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2011-09-14 18:08 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: openembedded-core@lists.openembedded.org

On Wed, Sep 14, 2011 at 15:01, Tom Zanussi <tom.zanussi@intel.com> wrote:
> 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.
>
> Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



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

* [PATCH 2/2] initramfs-live-install: add support for grub2
@ 2011-09-14 18:44 Tom Zanussi
  2011-09-14 18:50 ` Otavio Salvador
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Zanussi @ 2011-09-14 18:44 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

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.

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
 .../initrdscripts/files/init-install.sh            |   31 ++++++++++++++++----
 .../initrdscripts/initramfs-live-install_1.0.bb    |    8 ++---
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 5e6b81c..fb6cea8 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 #
-# Copyright (C) 2008 Intel
+# Copyright (C) 2008-2011 Intel
 #
 # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
 #
@@ -126,6 +126,7 @@ mkswap $swap
 
 mkdir /ssd
 mkdir /rootmnt
+mkdir /bootmnt
 
 mount $rootfs /ssd
 mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
@@ -142,6 +143,16 @@ if [ -d /ssd/etc/ ] ; then
     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 /rootmnt
 
@@ -151,11 +162,19 @@ grub-install --root-directory=/ssd /dev/${device}
 
 echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
 
-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
+if [ -f /ssd/40_custom ] ; then
+    mv /ssd/40_custom /ssd/boot/grub/grub.cfg
+    sed -i "/#/d" /ssd/boot/grub/grub.cfg
+    sed -i "/exec tail/d" /ssd/boot/grub/grub.cfg
+    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/
 
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 0eeabf1..619b16c 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -1,9 +1,9 @@
-DESCRIPTION = "A live image init script"
+DESCRIPTION = "A live image init script for grub"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 SRC_URI = "file://init-install.sh"
 
-PR = "r4"
+PR = "r5"
 
 RDEPENDS="grub parted e2fsprogs-mke2fs"
 
@@ -19,6 +19,4 @@ INHIBIT_DEFAULT_DEPS = "1"
 
 FILES_${PN} = " /install.sh "
 
-# Alternatives to grub need adding for other arch support
-# consistent with grub 0.97
-COMPATIBLE_HOST = "i.86.*-linux"
+COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
-- 
1.7.0.4






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

* Re: [PATCH 2/2] initramfs-live-install: add support for grub2
  2011-09-14 18:44 Tom Zanussi
@ 2011-09-14 18:50 ` Otavio Salvador
  0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2011-09-14 18:50 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Wed, Sep 14, 2011 at 15:44, Tom Zanussi <tom.zanussi@intel.com> wrote:
> 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.
>
> Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



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

end of thread, other threads:[~2011-09-14 18:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 18:01 [PATCH 2/2] initramfs-live-install: add support for grub2 Tom Zanussi
2011-09-14 18:08 ` Otavio Salvador
  -- strict thread matches above, loose matches on Subject: below --
2011-09-14 18:44 Tom Zanussi
2011-09-14 18:50 ` Otavio Salvador
2011-09-14 16:12 Tom Zanussi
2011-09-14 17:03 ` Otavio Salvador

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