Here is a script to create initrd image for busybox: #!/bin/bash # 2006 by Marco Amrein, released into Public Domain, except the patch lines for # .config, which are probably GPL'd and thus (C). set -euv BB=busybox-1.1.0 apt-get install wget gcc e2fsprogs || true [ -f $BB.tar.gz ] || wget http://www.busybox.net/downloads/$BB.tar.gz || exit 1 [ -d $BB ] || tar xvfz $BB.tar.gz || exit 1 if [ ! -x $BB/busybox ] ; then cd $BB make clean make allyesconfig patch <<__endconfpatch__ span=""> --- .config.orig 2006-02-11 18:03:59.000000000 +0100 +++ .config 2006-02-11 18:05:08.000000000 +0100 @@ -24,5 +24,5 @@ # Build Options # -# CONFIG_STATIC is not set +CONFIG_STATIC=y CONFIG_LFS=y # USING_CROSS_COMPILER is not set @@ -511,9 +511,9 @@ # Shells # -# CONFIG_FEATURE_SH_IS_ASH is not set +CONFIG_FEATURE_SH_IS_ASH=y # CONFIG_FEATURE_SH_IS_HUSH is not set # CONFIG_FEATURE_SH_IS_LASH is not set # CONFIG_FEATURE_SH_IS_MSH is not set -CONFIG_FEATURE_SH_IS_NONE=y +# CONFIG_FEATURE_SH_IS_NONE is not set CONFIG_ASH=y __ENDCONFPATCH__ make oldconfig make cd .. fi dd if=/dev/zero of=bb-initrd.img count=1 bs=12M mke2fs -F -i 1024 bb-initrd.img mkdir -p bb-initrd mount -o loop bb-initrd.img bb-initrd cp -a /dev/.static/dev bb-initrd mkdir bb-initrd/proc mkdir bb-initrd/bin mkdir bb-initrd/sbin mkdir bb-initrd/tmp chmod 1777 bb-initrd/tmp mkdir bb-initrd/mnt mkdir bb-initrd/etc mkdir bb-initrd/etc/init.d touch bb-initrd/etc/mtab cp -a $BB/busybox bb-initrd/bin/ mount -t proc proc bb-initrd/proc chroot bb-initrd /bin/busybox --install -s umount bb-initrd/proc cat >bb-initrd/etc/init.d/rcS <#! /bin/sh /bin/mount -t proc proc proc #echo go for it! /bin/ash EOFrcS chmod 755 bb-initrd/etc/init.d/rcS umount bb-initrd gzip -9 bb-initrd.img echo 'We are done...' Thanks Marco Amrein!
Thursday, March 18, 2010
Initrd image for busybox
Labels:
buildroot,
Busybox,
embedded,
linux,
Stars InfoCom,
starsinfocom
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.