Absurditas Demens

Collection of personal tips, documentation, and more.


Project maintained by compenguy Hosted on GitHub Pages — Theme by mattgraham

Building a Custom OpenWRT kernel

Building the kernel

To build a custom kernel in lede:

$ git clone https://git.lede-project.org/source.git lede
$ cd lede
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a
$ make defconfig
$ make menuconfig
# set target system to x86
# set subtarget to x86_64
# set Target Images => Kernel partition size: 64MB
# Save
# Exit
$ make kernel_menuconfig CONFIG_TARGET=subtarget
# set 64-bit kernel
# Processor Type and Features => Processor family => Check Core 2/newer Xeon
# Processor Type and Features => Check x86 architectural random number generator
# Processor Type and Features => Check Symmetric Multiprocessing support
# Power Management and ACPI Options => Check Cpuidle Driver for Intel Processors
# Device Drivers => Serial ATA and Parallel ATA drivers (libata) => Check AHCI SATA support
# Device Drivers => Serial ATA and Parallel ATA drivers (libata) => Check Platform AHCI SATA support
# Device Drivers => Network device support => Ethernet driver support => Check Intel(R) PRO/1000 Gigabit Ethernet support
# Device Drivers => Network device support => Ethernet driver support => Check Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support
# Device Drivers => Network device support => Ethernet driver support => Check Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support
# Cryptographic API => Check AES cipher algorithms (AES-NI)
# disable support for various Vmware and MS virtualization technologies
# Save
# Exit
$ make V=99

References:

#Defaults init=”/sbin/init” root=”/dev/sda2”

#Mount things needed by this script mount -t proc proc /proc mount -t sysfs sysfs /sys

#Disable kernel messages from popping onto the screen echo 0 > /proc/sys/kernel/printk

#Clear the screen clear

#Create all the symlinks to /bin/busybox busybox –install -s

#Create device nodes mknod /dev/null c 1 3 mknod /dev/tty c 5 0 mdev -s

#Function for parsing command line options with “=” in them

get_opt(“init=/sbin/init”) will return “/sbin/init”

get_opt() { echo “$@” | cut -d “=” -f 2 }

Process command line options

for i in $(cat /proc/cmdline); do case $i in root=) root=$(get_opt $i) ;; init=) init=$(get_opt $i) ;; esac done

Mount the root device

mount “${root}” /newroot

Check if $init exists and is executable

if [[ -x “/newroot/${init}” ]] ; then #Unmount all other mounts so that the ram used by #the initramfs can be cleared after switch_root umount /sys /proc

#Switch to the new root and execute init
exec switch_root /newroot "${init}" fi

This will only be run if the exec above failed

echo “Failed to switch_root, dropping to a shell” exec sh

* and finally, write the entire directory tree to a cpio archive:
```bash
cd initramfs
find . | cpio -H newc -o > ../initramfs.cpio
cd ..
gzip initramfs.cpio

EFI Booting

EFI booting Lede:

References: