Add create_linux_template.sh
This commit is contained in:
parent
d4f946dbc9
commit
52cb2e58e6
|
@ -0,0 +1,50 @@
|
|||
# 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
|
Loading…
Reference in New Issue