my-linux

os on linux kernel from scratch
git clone git://git.evenfri.xyz/my-linux.git
Log | Files | Refs | README

initramfs.sh (461B)


      1 #!/bin/sh
      2 
      3 hostname="tux"
      4 output="initramfs.cpio.gz"
      5 
      6 rm -rf rootfs
      7 
      8 mkdir -p rootfs/dev \
      9          rootfs/proc \
     10          rootfs/sys \
     11          rootfs/bin \
     12          rootfs/etc
     13 
     14 echo "$hostname" > rootfs/etc/hostname
     15 
     16 find ./coreutils -type f -name "o.*" | while read -r f; do
     17   name=$(basename "$f" | sed 's/^o\.//')
     18   cp "$f" "./rootfs/bin/$name"
     19 done
     20 
     21 rm -f "$output"
     22 
     23 cd rootfs
     24 find . -print0 | cpio --null -ov --format=newc | gzip -9 > "../$output"
     25 cd ..