From 0747af5e3e149686a2aa447dd9b59fc65c9ae473 Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sun, 23 Jul 2017 16:23:19 +0300 Subject: [PATCH] Added simple scripts for generic automation. --- .gitignore | 8 ++++++++ clean.sh | 3 +++ minimal.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ qemu64.sh | 3 +++ 4 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100755 clean.sh create mode 100755 minimal.sh create mode 100755 qemu64.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d178e91f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.gitignore +busybox* +isoimage +kernel* +linux* +*.iso +syslinux* + diff --git a/clean.sh b/clean.sh new file mode 100755 index 000000000..3a476b20a --- /dev/null +++ b/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh +rm -rf busybox* isoimage kernel* linux* *.iso syslinux* + diff --git a/minimal.sh b/minimal.sh new file mode 100755 index 000000000..9e0bf5468 --- /dev/null +++ b/minimal.sh @@ -0,0 +1,49 @@ +#!/bin/sh +set -ex +KERNEL_VERSION=4.12.3 +BUSYBOX_VERSION=1.27.1 +SYSLINUX_VERSION=6.03 +wget -O kernel.tar.xz http://kernel.org/pub/linux/kernel/v4.x/linux-$KERNEL_VERSION.tar.xz +wget -O busybox.tar.bz2 http://busybox.net/downloads/busybox-$BUSYBOX_VERSION.tar.bz2 +wget -O syslinux.tar.xz http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-$SYSLINUX_VERSION.tar.xz +tar -xvf kernel.tar.xz +tar -xvf busybox.tar.bz2 +tar -xvf syslinux.tar.xz +mkdir isoimage +cd busybox-$BUSYBOX_VERSION +make distclean defconfig +sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config +make busybox install +cd _install +rm -f linuxrc +mkdir dev proc sys +echo '#!/bin/sh' > init +echo 'dmesg -n 1' >> init +echo 'mount -t devtmpfs none /dev' >> init +echo 'mount -t proc none /proc' >> init +echo 'mount -t sysfs none /sys' >> init +echo 'setsid cttyhack /bin/sh' >> init +chmod +x init +find . | cpio -R root:root -H newc -o | gzip > ../../isoimage/rootfs.gz +cd ../../linux-$KERNEL_VERSION +make mrproper defconfig bzImage +cp arch/x86/boot/bzImage ../isoimage/kernel.gz +cd ../isoimage +cp ../syslinux-$SYSLINUX_VERSION/bios/core/isolinux.bin . +cp ../syslinux-$SYSLINUX_VERSION/bios/com32/elflink/ldlinux/ldlinux.c32 . +echo 'default kernel.gz initrd=rootfs.gz' > ./isolinux.cfg +genisoimage \ + -J \ + -r \ + -o ../minimal_linux_live.iso \ + -b isolinux.bin \ + -c boot.cat \ + -input-charset UTF-8 \ + -no-emul-boot \ + -boot-load-size 4 \ + -boot-info-table \ + -joliet-long \ + ./ +cd .. +set +ex + diff --git a/qemu64.sh b/qemu64.sh new file mode 100755 index 000000000..4c72599a7 --- /dev/null +++ b/qemu64.sh @@ -0,0 +1,3 @@ +#!/bin/sh +qemu-system-x86_64 -m 128M -cdrom minimal_linux_live.iso -boot d -vga std +