tar jxvf busybox-1.32.0.tar.bz2cd busybox-1.32.0mkdir buildmake O=build ARCH=arm64 defconfigmake O=build ARCH=arm64 menuconfig# Modify the following configurations# [*] Don't use /usr# [*] Build static binary (no shared libs)# (aarch64-linux-gnu-) Cross compiler prefixmake O=buildmake O=build installcd build/_install# Create empty directoriesmkdir -pv {etc,proc,sys,usr/{bin,sbin}}vim init# Set the init file as follows# #!/bin/sh# mount -t proc none /proc# mount -t sysfs none /sys# echo -e "\nBoot took $(cut -d' ' -f1 /proc/uptime) seconds\n"# exec /bin/shchmod +x init# Package the cpio filesystem to generate busybox ramdisk filesystemfind . -print0 | cpio --null -ov --format=newc | gzip > ../initramfs.cpio.gz
Compile the Linux Kernel
cd /xxx/linux-4.19.157mkdir buildmake O=build ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- allnoconfigmake O=build ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig# Modify the following configurations# -> General setup# [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support# -> General setup# -> Configure standard kernel features# [*] Enable support for printk# -> Executable file formats / Emulations# [*] Kernel support for ELF binaries# [*] Kernel support for scripts starting with #!# -> Device Drivers# -> Generic Driver Options# [*] Maintain a devtmpfs filesystem to mount at /dev# [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs# -> Device Drivers# -> Character devices# [*] Enable TTY# -> Device Drivers# -> Character devices# -> Serial drivers# [*] ARM AMBA PL010 serial port support# [*] Support for console on AMBA serial port# [*] ARM AMBA PL011 serial port support# [*] Support for console on AMBA serial port# -> File systems# -> Pseudo filesystems# [*] /proc file system support# [*] sysfs file system supportmake O=build ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8