aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: f285004fa0ea221856175cc71ba5a9e78bd55735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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