51 lines
848 B
Bash
51 lines
848 B
Bash
# setup
|
|
apt update
|
|
apt-get install bzip2 git vim make gcc libncurses-dev flex bison bc cpio libelf-dev libssl-dev syslinux dosfstools
|
|
|
|
git clone --depth 1 https://github.com/torvalds/linux.git
|
|
|
|
cd linux
|
|
|
|
make menuconfig
|
|
# no change needed, just make sure 64bit is enabled
|
|
|
|
# check num of cores using nproc
|
|
make -j 4
|
|
|
|
mkdir /boot-files
|
|
cp arch/x86/boot/bzImage /boot-files/
|
|
cd ..
|
|
|
|
git clone --depth 1 https://git.busybox.net/busybox
|
|
cd busybox
|
|
|
|
# static build to keep it minimal
|
|
make menuconfig
|
|
|
|
make -j 4
|
|
|
|
mkdir /boot-files/initramfs
|
|
make CONFIG_PREFIX=/boot-files/initramfs install
|
|
|
|
cd /boot-files/initramfs/
|
|
|
|
echo -e '#!/bin/sh\n/bin/sh' > init
|
|
chmod +x init
|
|
|
|
rm linuxrc
|
|
|
|
find . | cpio -o -H newc > ../init.cpio
|
|
cd ..
|
|
|
|
dd if=/dev/zero of=boot bs=1M count=50
|
|
|
|
mkfs -t fat boot
|
|
|
|
syslinux boot
|
|
|
|
mkdir m
|
|
mount boot m
|
|
cp bzImage init.cpio m
|
|
|
|
umount m
|