From: hackbard Date: Thu, 16 Jul 2015 15:25:22 +0000 (+0200) Subject: cleaned up config for nellboard X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b26a3606849319172514337ce5e97534db17156e;p=outofuni%2Fdib.git cleaned up config for nellboard --- diff --git a/build.config b/build.config index 335eba8..a9eea21 100644 --- a/build.config +++ b/build.config @@ -3,29 +3,28 @@ # # size of the image in MB # -# 2GB - 48MB -IMGSIZE=2000 +IMGSIZE=3600 # # target architecture / suite # -ARCH=armhf -#ARCH=armel -MAKEOPT="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-" +#ARCH=armhf +ARCH=armel #MAKEOPT="ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-" +MAKEOPT="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-" EMU=qemu-arm-static SUITE=unstable # name -NAME=beagleboard -#NAME=nellboard +#NAME=beagleboard +NAME=nellboard # # filesystems # ROOTFS=xfs -#ROOTFS=ext4 -BOOTFS=ext3 +ROOTFS=ext4 +#BOOTFS=ext3 # debian mirror DEBMIRROR=http://ftp.de.debian.org/debian @@ -55,12 +54,7 @@ ADDPKGS="$ADDPKGS python dnsmasq" KERVER="2.6.33" KERPATCH="linux-2.6.33_lpc313x-v1.01.patch" KERCONF="ea313x_defconfig" -KERHOOK=" - sed 's/# CONFIG_DEVTMPFS.*/CONFIG_DEVTMPFS=y/' -i \ - ./arch/arm/configs/ea313x_defconfig; - sed 's/# CONFIG_EXT4_FS.*/CONFIG_EXT4_FS=y/' -i \ - ./arch/arm/configs/ea313x_defconfig; \ - cp ../files/lpc313x/ea313x.c arch/arm/mach-lpc313x/;" +KERHOOKS="nellboard_kernel_hooks.sh" # # u-boot patch and target diff --git a/build.sh b/build.sh index 703a604..efe6274 100755 --- a/build.sh +++ b/build.sh @@ -41,22 +41,21 @@ function build_all { else echo "building debian image, first stage ..." # image - validimg="no" if [ -f ./rootfs.img ]; then size=`ls -al ./rootfs.img | awk '{ print $5/1048576 }'` if [ "$size" = "$IMGSIZE" ]; then echo "rootfs.img exists" - validimg="yes" else echo "creating rootfs.img" + dd if=/dev/zero of=./rootfs.img \ + bs=1M count=$IMGSIZE fi fi - if [ "$validimg" = "no" ]; then - dd if=/dev/zero of=./rootfs.img bs=1M count=$IMGSIZE - fi # make fs and mount umount_if_mounted rootfs.mnt - mkfs.${ROOTFS} -f -L rootfs ./rootfs.img + FORCEFS="-F" + [ "$ROOTFS" = "xfs" ] && FORCEFS="-f" + mkfs.${ROOTFS} $FORCEFS -L rootfs ./rootfs.img rm -rf rootfs.mnt mkdir rootfs.mnt mount -o loop ./rootfs.img ./rootfs.mnt @@ -70,6 +69,10 @@ function build_all { # copy myself cp -v ./build.sh ./rootfs.mnt cp -v ./build.config ./rootfs.mnt + mkdir -p ./rootfs.mnt/post_routines + cp -v ./post_routines/$NAME/* ./rootfs.mnt/post_routines + mkdir -p ./rootfs.mnt/files + cp -rv ./files/$NAME/* ./rootfs.mnt/files if [ ! -f .build_stage2 ]; then # prepare/run second stage modprobe binfmt_misc @@ -91,6 +94,18 @@ function build_all { # cleanup rm -v ./rootfs.mnt/build.sh rm -v ./rootfs.mnt/build.config + rm -rfv ./rootfs.mnt/post_routines + rm -rfv ./rootfs.mnt/files + fi + # final things + echo + echo -en "build completed! want me to umount everything? [Y,n]: " + read answer + if [ "$answer" != "n" ]; then + mnts="rootfs.mnt/dev/pts rootfs.mnt/proc rootfs.mnt" + for mnt in $mnts; do + umount_if_mounted $mnt + done fi } @@ -117,16 +132,31 @@ function build_in_chroot { echo -en "auto lo\niface lo inet loopback\n" > /etc/network/interfaces echo -en "auto eth0\niface eth0 inet dhcp\n" >> /etc/network/interfaces echo -en "auto usb0\niface usb0 inet dhcp\n" >> /etc/network/interfaces - # login on serial console - num=`echo $GETTY | sed 's/\([a-zA-Z].*\)\([0-9].*\)/\2/'` - echo "T${num}:2345:respawn:/sbin/getty -L $GETTY 115200 linux" >> \ - /etc/inittab # hostname echo $NAME > /etc/hostname # root echo "/dev/root / $ROOTFS defaults 0 1" > /etc/fstab - # behavior of boot scripts - echo "HWCLOCKACCESS=no" >> /etc/default/rcS + # determine init type + if [ "`file /sbin/init | awk '{ print $2 }'`" = "symbolic" ]; then + symlink=`ls -al /sbin/init | awk -F'->' '{ print $2 }'` + inittype=`basename $symlink` + else + inittype=sysvinit + fi + # serial console + num=`echo $GETTY | sed 's/\([a-zA-Z].*\)\([0-9].*\)/\2/'` + case "$inittype" in + systemd) + # nothing required to enable serial console + ;; + sysvinit) + echo -en "T${num}:2345:respawn:/sbin/getty -L " >> \ /etc/inittab + echo -en "$GETTY 115200 linux" >> /etc/inittab;; + *) + echo "unsupported init system: $inittype";; + esac + # more boot scripts + echo -en "\nHWCLOCKACCESS=no\n" >> /etc/default/rcS echo "CONCURRENCY=shell" >> /etc/default/rcS # additional packages apt-get -y install $ADDPKGS @@ -134,6 +164,10 @@ function build_in_chroot { passwd -d root # profile echo -en "\nalias l='ls -al --color'\n\n" >> /etc/profile + # post install hooks + for file in 'ls /post_routines'; do + . /post_routines/$file + done } # @@ -185,7 +219,7 @@ function build_uboot() { if [ "$nopatch" = "0" ]; then if [ ! -z "$UBPATCH" ]; then for patch in $UBPATCH; do - patch -Nfp1 < ../patches/$patch + patch -Nfp1 < ../patches/$NAME/$patch done fi fi @@ -235,7 +269,7 @@ function build_kernel() { if [ "$nopatch" = "0" ]; then if [ ! -z "$KERPATCH" ]; then for patch in $KERPATCH; do - patch -Nfp1 < ../patches/$patch + patch -Nfp1 < ../patches/$NAME/$patch done fi fi @@ -243,8 +277,10 @@ function build_kernel() { make $MAKEOPT mrproper fi if [ "$nohook" = "0" ]; then - if [ ! -z "$KERHOOK" ]; then - $KERHOOK + if [ ! -z "$KERHOOKS" ]; then + for hook in $KERHOOKS; do + . ../hooks/$hook + done fi fi if [ ! -z "$KERCONF" ]; then