#!/bin/bash # BBeOS Minimal Kernel Build Script # Builds a basic kernel for BlackBerry Classic Q20 set -e echo "Building minimal kernel for BBeOS..." # Set up environment export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- # Go to kernel source directory cd kernel-source # Clean previous build echo "Cleaning previous build..." make clean # Configure kernel echo "Configuring kernel..." make qcom_defconfig # Enable essential features echo "Enabling essential features..." ./scripts/config --enable CONFIG_SERIAL_MSM_CONSOLE ./scripts/config --enable CONFIG_MMC_MSM ./scripts/config --enable CONFIG_DRM_MSM ./scripts/config --enable CONFIG_SOUND_MSM ./scripts/config --enable CONFIG_INPUT ./scripts/config --enable CONFIG_GPIO_MSM_V3 ./scripts/config --enable CONFIG_I2C_MSM ./scripts/config --enable CONFIG_SPI_MSM ./scripts/config --enable CONFIG_USB_MSM_OTG ./scripts/config --enable CONFIG_WLAN_VENDOR_ATH ./scripts/config --enable CONFIG_BT ./scripts/config --enable CONFIG_EXT4_FS ./scripts/config --enable CONFIG_FAT_FS ./scripts/config --enable CONFIG_VFAT_FS ./scripts/config --enable CONFIG_DEBUG_FS ./scripts/config --enable CONFIG_DEBUG_KERNEL ./scripts/config --enable CONFIG_KGDB ./scripts/config --enable CONFIG_KGDB_SERIAL_CONSOLE # Disable unnecessary features echo "Disabling unnecessary features..." ./scripts/config --disable CONFIG_MODULES ./scripts/config --disable CONFIG_MODULE_UNLOAD ./scripts/config --disable CONFIG_MODVERSIONS ./scripts/config --disable CONFIG_MODULE_SRCVERSION_ALL # Set essential options echo "Setting essential options..." ./scripts/config --set-str CONFIG_CMDLINE "console=ttyMSM0,115200 root=/dev/mmcblk0p1 rw rootwait" ./scripts/config --set-str CONFIG_CMDLINE_FROM_BOOTLOADER "y" ./scripts/config --set-str CONFIG_CMDLINE_EXTEND "y" # Enable initramfs support echo "Enabling initramfs support..." ./scripts/config --enable CONFIG_BLK_DEV_INITRD ./scripts/config --set-str CONFIG_INITRAMFS_SOURCE "" ./scripts/config --set-val CONFIG_INITRAMFS_ROOT_UID 0 ./scripts/config --set-val CONFIG_INITRAMFS_ROOT_GID 0 # Apply configuration echo "Applying configuration..." make olddefconfig # Build kernel echo "Building kernel..." make -j$(nproc) zImage # Build device tree echo "Building device tree..." make dtbs echo "Kernel build complete!" echo "Files created:" echo " - arch/arm/boot/zImage (kernel image)" echo " - arch/arm/boot/dts/qcom/qcom-msm8960-blackberry-q20-simple.dtb (device tree)"