简体   繁体   English

树莓派 kernel 交叉编译缺少配置选项?

[英]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 eg L2 cache or branch prediction) I cannot find anything (with search).我从我的 x86(docker 上的 ubuntu 容器)交叉编译了一个 RPI3 32 位 kernel(docker 上的 ubuntu 容器),当尝试禁用某些变量时(在我的情况下,例如 L2 缓存或分支预测)我找不到任何东西(通过搜索)。 On the RPI itself menuconfig showed those settings in "System Type" but this menu isnt even there.在 RPI 本身 menuconfig 在“系统类型”中显示了这些设置,但该菜单甚至不存在。

I followed the official RPI kernel build guide我遵循官方 RPI kernel 构建指南

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_ICACHE_DISABLE
CPU_DCACHE_DISABLE CPU_DCACHE_DISABLE
Disable branch prediction禁用分支预测


Update:更新:
For simpler make commands I set some environment variables对于更简单的 make 命令,我设置了一些环境变量

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.然后在运行make defconfig (默认配置基于'multi_v7_defconfig')时,生成的make menuconfig比我所期望的要多得多。

I still need to verify, building now.我仍然需要验证,现在正在构建。

Not sure why, but I can see the menus and variables.不知道为什么,但我可以看到菜单和变量。 Even removed the linux folder made a clean start.即使删除了 linux 文件夹,也可以重新开始。

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.将 SD 卡移至 RPI 并启动。 (uname -a shows new compile time and no SMP when disabled) (uname -a 显示新的编译时间,禁用时没有 SMP)

Sidenote to docker if someone is interested.如果有人感兴趣,请在 docker 旁注。 I run a ubuntu docker with both mounted partitions as shared folders.我运行 ubuntu docker 并将两个已安装的分区作为共享文件夹。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM