#!/bin/sh OLDPWD="$PWD" cd "$(dirname "$0")" BUSYBOX_SRC="$(realpath ../busybox)" BUSYBOX_FS="$(realpath ../busybox/rootfs)" OVERLAY_FS="$(realpath ../rootfs)" cd "$OLDPWD" # change into the (mounted) target rootfs folder cd "$1" # scaffold folders for dir in \ bin dev etc home lib proc root sbin srv sys tmp usr var \ var/log var/run \ etc/network/if-down.d etc/network/if-post-down.d \ etc/network/if-pre-up.d etc/network/if-up.d \ usr/share/udhcpc do mkdir -p "$dir" done # create special devices ! [ -c dev/mem ] && mknod dev/mem c 1 1 ! [ -c dev/null ] && mknod dev/null c 1 3 ! [ -c dev/random ] && mknod dev/random c 1 8 ! [ -c dev/urandom ] && mknod dev/urandom c 1 9 ! [ -c dev/zero ] && mknod dev/zero c 1 5 # copy busybox files and overlay files CPFLAGS='--no-dereference --recursive --preserve=mode,timestamps,links --no-preserve=owner' cp $CPFLAGS "$BUSYBOX_FS/." . cp $CPFLAGS "$OVERLAY_FS/." . # remove legacy files rm linuxrc # setuid busybox chmod a=xrs,u+w bin/busybox # exit safely (continue makefile) exit 0