diff options
| author | John Ogness <john.ogness@linutronix.de> | 2018-04-05 09:27:36 +0200 |
|---|---|---|
| committer | John Ogness <john.ogness@linutronix.de> | 2018-04-05 09:27:36 +0200 |
| commit | 74f93d82fc36156602164b540349c1c83fe4e2b6 (patch) | |
| tree | ec084c58eabb06b0538700c38e911a405c027d77 /schulung_tools/rootfs_basic/scripts/create_rootfs.sh | |
| parent | 674363214075c751df862ae87a9cd5ab28194cce (diff) | |
add rootfs_basic scripts
These scripts are provided to participants after the training to
allow them to quickly/easily reproduce the many steps of creating
a simple root filesystem from scratch.
These scripts also serve as an excellent reference for trainers
to follow during the live excercises.
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Diffstat (limited to 'schulung_tools/rootfs_basic/scripts/create_rootfs.sh')
| -rwxr-xr-x | schulung_tools/rootfs_basic/scripts/create_rootfs.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/schulung_tools/rootfs_basic/scripts/create_rootfs.sh b/schulung_tools/rootfs_basic/scripts/create_rootfs.sh new file mode 100755 index 0000000..1ba104a --- /dev/null +++ b/schulung_tools/rootfs_basic/scripts/create_rootfs.sh @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +CROSS_BASE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf +CROSS_LIBC=$CROSS_BASE/arm-linux-gnueabihf/libc + +# create directories +mkdir -p nfsroot/dev +mkdir -p nfsroot/proc +mkdir -p nfsroot/sys +mkdir -p nfsroot/lib +mkdir -p nfsroot/bin +mkdir -p nfsroot/etc/ld.so.conf.d +mkdir -p nfsroot/opt/acme/lib + +# copy dependencies +cp $CROSS_LIBC/lib/ld-2.23.so nfsroot/lib/ +cp $CROSS_LIBC/lib/libc-2.23.so nfsroot/lib/ +cp $CROSS_LIBC/lib/libm-2.23.so nfsroot/lib/ + +# copy busybox + links +cp -a busybox-1.28.1/_install/* nfsroot/ + +# copy gdbserver +cp $CROSS_BASE/bin/gdbserver nfsroot/bin/ + +# copy hello/libfunc +cp ../src/hello/hello nfsroot/bin/ +cp ../src/hello/libhello.so.0.0.1 nfsroot/opt/acme/lib/ + +# create ldconfig configuration files +echo 'include /etc/ld.so.conf.d/*.conf' > nfsroot/etc/ld.so.conf +echo '/opt/acme/lib' > nfsroot/etc/ld.so.conf.d/acme.conf + +# create dynamic loader cache +qemu-arm $CROSS_LIBC/sbin/ldconfig -r nfsroot +qemu-arm $CROSS_LIBC/sbin/ldconfig -r nfsroot -p + +# create init configuation +cat > nfsroot/etc/inittab << 'EOF' +::sysinit:/etc/rcS +::askfirst:-/bin/sh +EOF + +# create start script +cat > nfsroot/etc/rcS << 'EOF' +#!/bin/sh + +mount -t proc proc /proc +mount -t sysfs sys /sys +mount -t tmpfs tmpfs /dev +mdev -s +echo /sbin/mdev > /proc/sys/kernel/hotplug +EOF +chmod 0755 nfsroot/etc/rcS |
