From 74f93d82fc36156602164b540349c1c83fe4e2b6 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Thu, 5 Apr 2018 09:27:36 +0200 Subject: 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 --- .../rootfs_basic/scripts/create_rootfs.sh | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 schulung_tools/rootfs_basic/scripts/create_rootfs.sh (limited to 'schulung_tools/rootfs_basic/scripts/create_rootfs.sh') 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 -- cgit v1.2.3