Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] initrd contamination and explict PATH
@ 2011-09-15 22:41 Darren Hart
  2011-09-15 22:41 ` [PATCH 1/2] Set an explicit path for the initrd scripts Darren Hart
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Darren Hart @ 2011-09-15 22:41 UTC (permalink / raw)
  To: openembedded-core

I ran into a bit of a nasty issue where EXTRA_IMAGE_FEATURES set in my
local.conf was causing core-image-initramfs to pull a bunch of files into
my initrd, including bash and a 100+MB vmlinux image. The 85M initrd caused
some strange initial boot behavior, and bash in the initrd caused our init
scripts to fail as bash has a different default PATH than busybox.

The following patches address these issues.

Live boot tested on 32 bit x86.

The following changes since commit bb4a5c44da23a1bb363f1f081cf1644fd7975957:

  linux-yocto: remove emenlow from meta-yocto bbappend (2.6.37 version) (2011-09-15 11:27:22 +0100)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib dvhart/initrdscripts
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/initrdscripts

Darren Hart (2):
  Set an explicit path for the initrd scripts
  Prevent IMAGE_FEATURES from contaminating initrd

 .../images/core-image-minimal-initramfs.bb         |    3 +++
 meta/recipes-core/initrdscripts/files/init-boot.sh |    2 ++
 .../initrdscripts/files/init-install.sh            |    2 ++
 meta/recipes-core/initrdscripts/files/init-live.sh |    4 +++-
 4 files changed, 10 insertions(+), 1 deletions(-)

-- 
1.7.6




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

* [PATCH 1/2] Set an explicit path for the initrd scripts
  2011-09-15 22:41 [PATCH 0/2] initrd contamination and explict PATH Darren Hart
@ 2011-09-15 22:41 ` Darren Hart
  2011-09-15 22:41 ` [PATCH 2/2] Prevent IMAGE_FEATURES from contaminating initrd Darren Hart
  2011-09-16 12:32 ` [PATCH 0/2] initrd contamination and explict PATH Richard Purdie
  2 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2011-09-15 22:41 UTC (permalink / raw)
  To: openembedded-core

If we don't set PATH, then the shell will specify one for us.
Busybox adds the sbin dirs, but bash does not. I hit an
issue where bash (among other things) ended up in my initrd
and the boot scripts failed due to a bad default PATH. While
that is a separate issue, we should not be at the mercy of the
shell's default PATH. Update the initrdscripts to all specify:

PATH=/sbin:/bin:/usr/sbin:/usr/bin

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 meta/recipes-core/initrdscripts/files/init-boot.sh |    2 ++
 .../initrdscripts/files/init-install.sh            |    2 ++
 meta/recipes-core/initrdscripts/files/init-live.sh |    4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-boot.sh b/meta/recipes-core/initrdscripts/files/init-boot.sh
index 9d804fc..e82eba0 100644
--- a/meta/recipes-core/initrdscripts/files/init-boot.sh
+++ b/meta/recipes-core/initrdscripts/files/init-boot.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 mkdir /proc
 mkdir /sys
 mount -t proc proc /proc
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index fb6cea8..d31d994 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -5,6 +5,8 @@
 # install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
 #
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 # We need 20 Mb for the boot partition
 boot_size=20
 
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 6a1deba..c054863 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
 ROOT_MOUNT="/rootfs/"
 ROOT_IMAGE="rootfs.img"
 MOUNT="/bin/mount"
@@ -12,7 +14,7 @@ early_setup() {
     mount -t proc proc /proc
     mount -t sysfs sysfs /sys
     udevd --daemon
-    /sbin/udevadm trigger --action=add
+    udevadm trigger --action=add
 }
 
 read_args() {
-- 
1.7.6




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

* [PATCH 2/2] Prevent IMAGE_FEATURES from contaminating initrd
  2011-09-15 22:41 [PATCH 0/2] initrd contamination and explict PATH Darren Hart
  2011-09-15 22:41 ` [PATCH 1/2] Set an explicit path for the initrd scripts Darren Hart
@ 2011-09-15 22:41 ` Darren Hart
  2011-09-16 12:32 ` [PATCH 0/2] initrd contamination and explict PATH Richard Purdie
  2 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2011-09-15 22:41 UTC (permalink / raw)
  To: openembedded-core

Set IMAGE_FEATURES="" in core-image-initramfs to prevent
the setting of things like EXTRA_IMAGE_FEATURES in local.conf
from contaminating the initrd with features meant for the rootfs.

Suggested-by: Richard Purdie <richardpurdie@linuxfoundation.org>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 .../images/core-image-minimal-initramfs.bb         |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/meta/recipes-core/images/core-image-minimal-initramfs.bb b/meta/recipes-core/images/core-image-minimal-initramfs.bb
index 3246d5c..0bac27a 100644
--- a/meta/recipes-core/images/core-image-minimal-initramfs.bb
+++ b/meta/recipes-core/images/core-image-minimal-initramfs.bb
@@ -2,6 +2,9 @@
 
 IMAGE_INSTALL = "initramfs-live-boot initramfs-live-install busybox udev base-passwd"
 
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
 export IMAGE_BASENAME = "core-image-minimal-initramfs"
 IMAGE_LINGUAS = ""
 
-- 
1.7.6




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

* Re: [PATCH 0/2] initrd contamination and explict PATH
  2011-09-15 22:41 [PATCH 0/2] initrd contamination and explict PATH Darren Hart
  2011-09-15 22:41 ` [PATCH 1/2] Set an explicit path for the initrd scripts Darren Hart
  2011-09-15 22:41 ` [PATCH 2/2] Prevent IMAGE_FEATURES from contaminating initrd Darren Hart
@ 2011-09-16 12:32 ` Richard Purdie
  2011-09-17 19:54   ` Darren Hart
  2 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2011-09-16 12:32 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Thu, 2011-09-15 at 15:41 -0700, Darren Hart wrote:
> I ran into a bit of a nasty issue where EXTRA_IMAGE_FEATURES set in my
> local.conf was causing core-image-initramfs to pull a bunch of files into
> my initrd, including bash and a 100+MB vmlinux image. The 85M initrd caused
> some strange initial boot behavior, and bash in the initrd caused our init
> scripts to fail as bash has a different default PATH than busybox.
> 
> The following patches address these issues.
> 
> Live boot tested on 32 bit x86.
> 
> The following changes since commit bb4a5c44da23a1bb363f1f081cf1644fd7975957:
> 
>   linux-yocto: remove emenlow from meta-yocto bbappend (2.6.37 version) (2011-09-15 11:27:22 +0100)
> 
> are available in the git repository at:
>   git://git.pokylinux.org/poky-contrib dvhart/initrdscripts
>   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/initrdscripts
> 
> Darren Hart (2):
>   Set an explicit path for the initrd scripts
>   Prevent IMAGE_FEATURES from contaminating initrd
> 
>  .../images/core-image-minimal-initramfs.bb         |    3 +++
>  meta/recipes-core/initrdscripts/files/init-boot.sh |    2 ++
>  .../initrdscripts/files/init-install.sh            |    2 ++
>  meta/recipes-core/initrdscripts/files/init-live.sh |    4 +++-
>  4 files changed, 10 insertions(+), 1 deletions(-)

Merged to master but I had to add PR bumps for the script PATH changes.

We shouldn't really be hardcoding the paths but using the expressions
${bindir} etc and making substitutions in the scripts too but we can
leave that issue for another time (they already had other hardcoded
issues).

Cheers,

Richard





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

* Re: [PATCH 0/2] initrd contamination and explict PATH
  2011-09-16 12:32 ` [PATCH 0/2] initrd contamination and explict PATH Richard Purdie
@ 2011-09-17 19:54   ` Darren Hart
  0 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2011-09-17 19:54 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 09/16/2011 05:32 AM, Richard Purdie wrote:
> On Thu, 2011-09-15 at 15:41 -0700, Darren Hart wrote:
>> I ran into a bit of a nasty issue where EXTRA_IMAGE_FEATURES set in my
>> local.conf was causing core-image-initramfs to pull a bunch of files into
>> my initrd, including bash and a 100+MB vmlinux image. The 85M initrd caused
>> some strange initial boot behavior, and bash in the initrd caused our init
>> scripts to fail as bash has a different default PATH than busybox.
>>
>> The following patches address these issues.
>>
>> Live boot tested on 32 bit x86.
>>
>> The following changes since commit bb4a5c44da23a1bb363f1f081cf1644fd7975957:
>>
>>   linux-yocto: remove emenlow from meta-yocto bbappend (2.6.37 version) (2011-09-15 11:27:22 +0100)
>>
>> are available in the git repository at:
>>   git://git.pokylinux.org/poky-contrib dvhart/initrdscripts
>>   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/initrdscripts
>>
>> Darren Hart (2):
>>   Set an explicit path for the initrd scripts
>>   Prevent IMAGE_FEATURES from contaminating initrd
>>
>>  .../images/core-image-minimal-initramfs.bb         |    3 +++
>>  meta/recipes-core/initrdscripts/files/init-boot.sh |    2 ++
>>  .../initrdscripts/files/init-install.sh            |    2 ++
>>  meta/recipes-core/initrdscripts/files/init-live.sh |    4 +++-
>>  4 files changed, 10 insertions(+), 1 deletions(-)
> 
> Merged to master but I had to add PR bumps for the script PATH changes.
> 
> We shouldn't really be hardcoding the paths but using the expressions
> ${bindir} etc and making substitutions in the scripts too but we can
> leave that issue for another time (they already had other hardcoded
> issues).

ARG... Sorry about missing the PR. As for the ${bindir}, would you
prefer a patch post 1.1 ? Or would you take one for 1.1 by EOD Monday?

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



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

end of thread, other threads:[~2011-09-17 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 22:41 [PATCH 0/2] initrd contamination and explict PATH Darren Hart
2011-09-15 22:41 ` [PATCH 1/2] Set an explicit path for the initrd scripts Darren Hart
2011-09-15 22:41 ` [PATCH 2/2] Prevent IMAGE_FEATURES from contaminating initrd Darren Hart
2011-09-16 12:32 ` [PATCH 0/2] initrd contamination and explict PATH Richard Purdie
2011-09-17 19:54   ` Darren Hart

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