[arch-projects] [mkinitcpio][PATCH 20/26] setup busybox during image creation instead of runtime

Tom Gundersen teg at jklm.no
Tue Sep 27 05:41:31 EDT 2011


On Tue, Sep 27, 2011 at 3:22 AM, Dave Reisner <d at falconindy.com> wrote:
> This is a constant which will never vary based on setup. Do it during
> the build to save the forks at runtime.
>
> Signed-off-by: Dave Reisner <dreisner at archlinux.org>

Acked-by: Tom Gundersen <teg at jklm.no>

BUT:

Not that this might cause issues with the next release of busybox.
They have changed things in evil ways and don't seem to want to revert
it.

A foolproof way to solve the problem is to loop over the list of apps
(which busybox will give you) and create the symlinks manually.

The downside of that is that all links will end up in the same dir,
but the distinctions between {,/usr}/{,s}bin don't make any sense in
an initramfs anyway, so that should be fine.

> ---
>  init         |    4 ----
>  install/base |    5 ++++-
>  2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/init b/init
> index f14261d..8891a69 100644
> --- a/init
> +++ b/init
> @@ -1,12 +1,8 @@
>  #!/bin/busybox ash
> -# Install busybox's applets as symlinks
>  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>
> -busybox --install -s
> -
>  . /init_functions
>
> -mkdir -p /new_root
>  mount -t proc proc /proc -o nosuid,noexec,nodev
>  mount -t sysfs sys /sys -o nosuid,noexec,nodev
>  if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
> diff --git a/install/base b/install/base
> index e85551c..9135ced 100644
> --- a/install/base
> +++ b/install/base
> @@ -1,10 +1,13 @@
>  #!/bin/bash
>
>  build() {
> -    for dir in proc sys dev run usr/{bin,sbin}; do
> +    for dir in proc sys dev run usr/{bin,sbin} new_root; do
>         add_dir "/$dir"
>     done
>
> +    # install busybox's applets as symlinks
> +    /lib/initcpio/busybox --install -s "$BUILDROOT/usr/bin"
> +
>     add_binary /lib/initcpio/busybox /bin/busybox
>     add_binary /sbin/modprobe
>     add_binary /sbin/blkid
> --
> 1.7.6.4
>
>


More information about the arch-projects mailing list