From 00312e004f7fa0bfe077708818b030890a1a63d9 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sat, 4 Jun 2022 08:29:21 +0430 Subject: updates --- vagrant/build_linux.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 vagrant/build_linux.sh (limited to 'vagrant') diff --git a/vagrant/build_linux.sh b/vagrant/build_linux.sh new file mode 100755 index 0000000..4f53762 --- /dev/null +++ b/vagrant/build_linux.sh @@ -0,0 +1,82 @@ +#!/usr/bin/sh +set -e + +BUSY_BOX_VERSION="1.35.0" +KERNEL_VERSION="v5.10" +BUILD_BASE=$(pwd)/kernel-dev +INITRAMFS_BASE=$(pwd)/kernel-dev/initramfs + +# wont run wihtout static busybox. the install target should be static too. +mkdir -p ./kernel-dev/busybox +cd ./kernel-dev/busybox &&\ + wget https://www.busybox.net/downloads/busybox-$BUSY_BOX_VERSION.tar.bz2 &&\ + tar -xvf busybox-$BUSY_BOX_VERSION.tar.bz2 +cd busybox-$BUSY_BOX_VERSION &&\ + make defconfig &&\ + LD_FLAGS="--static" make -j4 && make install + +cd "$BUILD_BASE" &&\ + git clone --depth=1 --branch ${KERNEL_VERSION} https://github.com/torvalds/linux +cd linux &&\ + make defconfig &&\ + make -j12 + +cd "$BUILD_BASE" &&\ + mkdir initramfs +(cd initramfs && mkdir -p bin sbin etc proc sys usr/bin usr/sbin dev tmp) +cp -a "${BUILD_BASE}"/busybox/busybox-$BUSY_BOX_VERSION/_install/* ./initramfs + +cat > "$INITRAMFS_BASE"/bin/init < "$INITRAMFS_BASE"/etc/inittab < "$INITRAMFS_BASE"/etc/init.d/rcS < /proc/sys/kernel/hotplug +mdev -s +echo "****************Hello itas109******************" +echo "Kernel Version:linux-5.4.50" +echo "***********************************************" +EOL +chmod 755 "$INITRAMFS_BASE"/etc/init.d/rcS + +cat > "$INITRAMFS_BASE"/etc/fstab < ../initramfs.cpio.gz + +qemu-system-x86_64 \ + -kernel "$BUILD_BASE"/linux/arch/x86/boot/bzImage \ + -initrd "$BUILD_BASE"/initramfs.cpio.gz \ + -nographic \ + -m 512 \ + -append "root=/dev/ram0 init=/bin/init console=ttyS0" -- cgit v1.2.3