#!/bin/bash # The following is a synthesis of info in: # # http://vmsplice.net/~stefan/stefanha-kernel-recipes-2015.pdf # http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/README # KBASE=../../linux #APPEND="console=ttyS0" function die { echo "$*" exit 1 } pushd .. make || die "failed to make libcap tree" popd # Assumes desired make *config (eg. make defconfig) is already done. pushd $KBASE pwd make V=1 all || die "failed to build kernel: $0" popd HERE=$(/bin/pwd) cat > fs.conf <> fs.conf done UCOMMANDS="id cut" for f in $UCOMMANDS; do echo slink /usr/bin/$f /sbin/busybox 0755 0 0 >> fs.conf done $KBASE/usr/gen_init_cpio fs.conf | gzip -9 > initramfs.img KERNEL=$KBASE/arch/x86_64/boot/bzImage qemu-system-$(uname -m) -m 1024 \ -kernel $KERNEL \ -initrd initramfs.img \ -append "$APPEND"