Instructions for compiling the kernel with your own settings, as well as compiling kernel modules for a specific kernel version.
$ apt-get install flex bison libelf-dev253git clone https://github.com/torvalds/linux --depth=1$ cd linux
$ rm -f .config$ make allnoconfig
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#CONFIG_64BIT=y
CONFIG_SMP=y
CONFIG_PRINTK=y
CONFIG_PRINTK_TIME=y
CONFIG_PCI=y
# We use an initramfs for busybox with elf binaries in it.
CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_SCRIPT=y
# This is for /dev file system.
CONFIG_DEVTMPFS=y
# For the power-down button (triggered by qemu's `system_powerdown` command).
CONFIG_INPUT=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_KEYBOARD=y
CONFIG_MODULES=y
CONFIG_KPROBES=n
CONFIG_LTO_NONE=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_EMBEDDED=n
CONFIG_TMPFS=y
CONFIG_RELOCATABLE=y
CONFIG_RANDOMIZE_BASE=y
CONFIG_USERFAULTFD=y$ scripts/kconfig/merge_config.sh .config ../kconfig$ make -j4all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesall:
make -C /home/ir0nstone/linux M=$(PWD) modules$ curl https://busybox.net/downloads/busybox-1.36.1.tar.bz2 | tar xjf -$ mkdir busybox_compiled$ cd busybox-1.36.1
$ make O=../busybox_compiled menuconfig$ cd ../busybox_compiled
$ make -j
$ make install$ cd ..
$ mkdir initramfs
$ cd initramfs
$ mkdir -pv {bin,dev,sbin,etc,proc,sys/kernel/debug,usr/{bin,sbin},lib,lib64,mnt/root,root}
$ cp -av ../busybox_compiled/_install/* .
$ sudo cp -av /dev/{null,console,tty,sda1} dev/#!/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/sh$ chmod +x initfind . -not -name *.cpio | cpio -o -H newc > initramfs.cpio$ cpio -i -F initramfs.cpio#!/bin/sh
qemu-system-x86_64 \
-kernel bzImage \
-initrd initramfs.cpio \
-append "console=ttyS0 quiet loglevel=3 oops=panic" \
-monitor /dev/null \
-nographic \
-no-reboot~ # whoami
whoami: unknown uid 0root:x:0:0:root:/root:/bin/sh
user:x:1000:1000:User:/home/user:/bin/shroot:x:0:
user:x:1000:#!/bin/sh
insmod /double_fetch.ko
mknod /dev/double_fetch c 253 0
chmod 666 /dev/double_fetch
mount -t proc none /proc
mount -t sysfs none /sys
mknod -m 666 /dev/ttyS0 c 4 64
setsid /bin/cttyhack setuidgid 1000 /bin/sh$ git fetch --tags$ git checkout v5.11