Search code examples
linuxraspberry-pikernelraspberry-pi3

raspberry pi kernel cross compile missing config options?


I cross compile a RPI3 32bit kernel from my x86 (ubuntu container on docker) and when tried to disable some variables (in my case e.g. L2 cache or branch prediction) I cannot find anything (with search). On the RPI itself menuconfig showed those settings in "System Type" but this menu isnt even there.

I followed the official RPI kernel build guide

sudo apt install crossbuild-essential-armhf

git clone --depth=1 https://github.com/raspberrypi/linux

export KERNEL=kernel7

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig

make menuconfig

What I expected to find were:
CPU_ICACHE_DISABLE
CPU_DCACHE_DISABLE
Disable branch prediction


Update:
For simpler make commands I set some environment variables

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export MAKEFLAGS=j4

Then when running make defconfig (Default configuration is based on 'multi_v7_defconfig') the resulting make menuconfig is a lot more what I was expecting.

I still need to verify, building now.


Solution

  • Not sure why, but I can see the menus and variables. Even removed the linux folder made a clean start.

    Here the commands ran:

    sudo mount /dev/mmcblk0p1 /mnt/fat32
    sudo mount /dev/mmcblk0p2 /mnt/ext4
    
    cd linux
    export KERNEL=kernel7 && export ARCH=arm && export CROSS_COMPILE=arm-linux-gnueabihf- && export MAKEFLAGS=j4 && export INSTALL_MOD_PATH=mnt/ext4
    
    make bcm2709_defconfig
    make menuconfig
    
    time make zImage modules dtbs
    
    env PATH=$PATH make modules_install
    cp arch/arm/boot/zImage /mnt/fat32/kernel_cross.img
    cp arch/arm/boot/dts/*.dtb /mnt/fat32/
    cp arch/arm/boot/dts/overlays/*.dtb* /mnt/fat32/overlays/
    cp arch/arm/boot/dts/overlays/README /mnt/fat32/overlays/
    
    exit
    
    sudo umount /mnt/ext4
    sudo umount /mnt/fat32
    

    Move SD card over to RPI and boot. (uname -a shows new compile time and no SMP when disabled)

    Sidenote to docker if someone is interested. I run a ubuntu docker with both mounted partitions as shared folders.

    sudo mount /dev/mmcblk0p1 /mnt/fat32
    sudo mount /dev/mmcblk0p2 /mnt/ext4
    docker run -it ubuntu -v /mnt/fat32/:/mnt/fat32 -v /mnt/ext4/:/mnt/ext4 /bin/bash