kanit

Toy init system
Log | Files | Refs | README | LICENSE

start (879B)


      1 #!/bin/sh
      2 set -ex
      3 
      4 MULTICALL="target/x86_64-unknown-linux-musl/$1/kanit-multicall"
      5 
      6 # clean rootfs
      7 rm -rf rootfs
      8 
      9 mkdir -p rootfs/sbin rootfs/etc/kanit/enabled
     10 mkdir -p rootfs/sbin rootfs/etc/kanit/system
     11 
     12 mkdir -p rootfs/etc/kanit/enabled/boot
     13 mkdir -p rootfs/etc/kanit/enabled/default
     14 
     15 cp units/* rootfs/etc/kanit/system
     16 
     17 # symlinks no work
     18 touch rootfs/etc/kanit/enabled/boot/syslog
     19 # getty is the devil
     20 # touch rootfs/etc/kanit/enabled/default/{getty@tty1,getty@ttyS0}
     21 
     22 cp "$MULTICALL" rootfs/sbin/init
     23 cp "$MULTICALL" rootfs/sbin/kanit
     24 cp "$MULTICALL" rootfs/sbin/kanit-supervisor
     25 
     26 [[ -e "/dev/kvm" ]] && KVM=-enable-kvm || KVM=""
     27 
     28 qemu-system-x86_64 -m 512 -nic user -kernel ./vmlinuz-virt -initrd ./initramfs -hda ./alpine.qcow2 \
     29  -virtfs local,path=./rootfs,mount_tag=host0,security_model=mapped,id=host0,multidevs=remap -nographic $KVM \
     30  -append "quiet console=ttyS0"