diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-04-24 01:00:36 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-04-24 01:00:36 +0300 |
commit | 2ca6677667af23ecb1e17479c5b5cc08efa53309 (patch) | |
tree | 37c4f62ac9f9ba124b37ca4767348c1f1ad74737 /build.sh |
init
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..f285004 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +set -e + +cd ${0%/*} # go to project root + +KERNEL="bin/kernel-$(uname -r)" +INITRAMFS="bin/initramfs" + +mkdir -p bin + +# get the kernel +sudo cp /boot/vmlinuz-linux-lts "$KERNEL" + +# initramfs directory +rm -rf $INITRAMFS +mkdir -p $INITRAMFS + +# copy the init file +cp src/init $INITRAMFS +chmod +x $INITRAMFS/init + +# get the busybox things +install -D $(which busybox) $INITRAMFS/bin/busybox +ln -sf busybox $INITRAMFS/bin/sh + +# make the image +(cd $INITRAMFS; find . | cpio -H newc -o | gzip > ../initramfs.img ) + +qemu-system-x86_64 \ + -kernel "$KERNEL" \ + -initrd "$INITRAMFS.img" \ + -append "console=ttyS0" -nographic |