ユーザ用ツール

サイト用ツール


サイドバー

最新の10件
一覧
sbc:raspberrypi:raspbian:buster:kernel_build

cross build

host: Debian bullseye amd64
Pi: Raspberry Pi 3 model B
OS: Raspberry Pi OS buster armef

Raspberry Pi OS側での操作

$ sudo modprobe configs

HostPCでの操作

$ #カーネルビルド向けのパッケージを導入
$ sudo apt install build-essential flex bison fakeroot gpg2
$ sudo apt build-dep linux
$ #クロスコンパイル用パッケージの導入
$ sudo apt install crossbuild-essential-armhf
$ #sourceの入手
$ wget https://github.com/raspberrypi/linux/archive/refs/tags/raspberrypi-kernel_1.20210527-1.zip
$ #sourceの展開
$ unzip raspberrypi-kernel_1.20210527-1.zip
$ cd raspberrypi-kernel_1.20210527-1
$ #Raspberry Piから.configを入手
$ ssh raspberrypi.local zcat /proc/config.gz ./.config
$ #.configを既定値で設定
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-matoken olddefconfig
$ #ここで `make menuconfig` 等で設定を変更したり,patch を適用したり
$ #build
$ time make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-le9 zImage modules dtbs
$ #boot以下をPiに転送
$ ssh raspberrypi.local mkdir -p ~/boot/dts/broadcom ~/boot/overlays
$ rsync avc arch/arm/boot/Image raspberrypi.local:~/boot/
$ rsync avc arch/arm/boot/dts/broadcom/*.dtb raspberrypi.local:~/boot/dts/broadcom/
$ rsync avc arch/arm/boot/dts/overlays/*.dtb* raspberrypi.local:~/boot/overlays/
$ rsync avc arch/arm/boot/dts/overlays/README raspberrypi.local:~/boot/overlays/

Raspberry Pi側の操作

$ #backup
$ tar cf - -C / boot | xz > boot-$(date +%F).tar.xz
$ #/bootを書き込みできるようにremount
$ sudo mount -o remount,rw /boot
$ sudo mv ~/boot/Image mnt/fat32/kernel7.img
$ sudo cp ~/boot/dts/broadcom/*.dtb mnt/fat32/
$ sudo cp ~/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
$ sudo cp ~/boot/dts/overlays/README mnt/fat32/overlays/
$ sync
$ sudo reboot

パッケージ化

(失敗)

buikd時に bindeb-pkg を付与すると普通にpkgが出来る

$ time make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-le9 zImage modules dtbs bindeb-pkg
$ ls -1 ../linux-*-le9*_armhf.deb
../linux-headers-5.10.17-v7-le9_5.10.17-v7-le9-1_armhf.deb
../linux-image-5.10.17-v7-le9_5.10.17-v7-le9-1_armhf.deb
../linux-libc-dev_5.10.17-v7-le9-1_armhf.deb

kernelのファイル名違いや /usr/lib/linux-image-<VERSION> 以下に展開されているのでこれを修正する必要がある(手動でcpすると動作する)

/boot
/boot/System.map-5.10.17-v7-le9
/boot/config-5.10.17-v7-le9
/boot/vmlinuz-5.10.17-v7-le9
  :
/usr/lib/linux-image-5.10.17-v7-le9
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-b-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-b-rev1.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-cm.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-zero-w.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2708-rpi-zero.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2709-rpi-2-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2710-rpi-2-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2710-rpi-3-b-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2710-rpi-3-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2710-rpi-cm3.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2711-rpi-4-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2711-rpi-400.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2711-rpi-cm4.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-a-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-a.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-b-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-b-rev2.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-cm1-io1.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-zero-w.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2835-rpi-zero.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2836-rpi-2-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2837-rpi-3-a-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2837-rpi-3-b-plus.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2837-rpi-3-b.dtb
/usr/lib/linux-image-5.10.17-v7-le9/bcm2837-rpi-cm3-io3.dtb
/usr/lib/linux-image-5.10.17-v7-le9/overlays
/usr/lib/linux-image-5.10.17-v7-le9/overlays/act-led.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/adafruit18.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/adau1977-adc.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/adau7002-simple.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/ads1015.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/ads1115.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/ads7846.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/adv7282m.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/adv728x-m.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/akkordion-iqdacplus.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/allo-boss-dac-pcm512x-audio.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/allo-boss2-dac-audio.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/allo-digione.dtbo
/usr/lib/linux-image-5.10.17-v7-le9/overlays/allo-katana-dac-audio.dtbo
  :

コメント

コメントを入力. Wiki文法が有効です:
     __  ____   _   __   ___    ____
 __ / / / __ \ | | / /  / _ \  / __/
/ // / / /_/ / | |/ /  / ___/ _\ \  
\___/  \___\_\ |___/  /_/    /___/
 
sbc/raspberrypi/raspbian/buster/kernel_build.txt · 最終更新: 2021/07/22 23:00 by matoken