Build Alpine's Root Filesystem (Bootstrap)
Prepare RAW Disk
- Create the disk image and have partitions: Boot and Root partition
- Format the the Boot and Root partition
Have the Kernel and Initial RAM Disk from Alpine
Download the NETBOOT image from Alpine's download. And, decompress it.
Here is another place to download https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/aarch64/netboot/
Bootstrap with QEMU VM
- Launch the QEMU aarch64 VM with the NETBOOT. We are going to take the normal aarch64 QEMU VM as the example. So, choose the NETBOOT image's vmlinuz-lts and initramfs-lts as the kernel and initial RAM disk
- Mount the root partition of the disk image in the VM
- Build the root filesystem with Alpine's bootstrap. And, the target root path is
/mnt/
- Add
ttyAMA0::respawn:/sbin/getty -L 0 ttyAMA0 vt100
into /mnt/etc/inittab
to get the VM's serial tty
- Set
/etc/fstab
- Set Network
- Enable networking service for each boot
- Exit the chroot and poweroff the VM
- Can launch a new QEMU aarch64 VM with own built kernel and the disk image
Reference