aboutsummaryrefslogblamecommitdiffhomepage
path: root/content/2019-10-27-kernel-debugging-qemu/build_kernel.sh
blob: 2789a0e167353aa9596af2d247dd9203c67e0010 (plain) (tree)
1
2
3
4
5
6



           

                                                               























                                             
                     
                   


                                                                         





                                                             
                          
#!/bin/bash

set -e

LINUX=linux-6.6.2
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/$LINUX.tar.xz
unxz $LINUX.tar.xz && tar xf $LINUX.tar

cd $LINUX

cat <<EOF > kernel_fragment.config
# 64bit kernel
CONFIG_64BIT=y
# enable support for compressed initrd (gzip)
CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y
# support for ELF and #! binary format
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_SCRIPT=y
# /dev
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# tty & console
CONFIG_TTY=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
# pseudo fs
CONFIG_PROC_FS=y
CONFIG_SYSFS=y
# debugging
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_INFO=y
## tinyconfig sets DEBUG_INFO_NONE, overwrite with toolchain default else
## DEBUG_INFO will not be enabled.
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_PRINTK=y
CONFIG_EARLY_PRINTK=y
EOF

make tinyconfig
./scripts/kconfig/merge_config.sh -n ./kernel_fragment.config
make -j$(nproc --ignore=2)