"Kernel" 修訂間的差異
(已建立頁面,內容為 "== source == * <nowiki>git clone git://github.com/raspberrypi/linux.git</nowiki> * <nowiki>svn co file:///var/svn/rpi_linux/trunk</nowiki> == toolchain == * <nowiki…") |
(無差異)
|
於 2018年8月23日 (四) 11:00 的最新修訂
source
- git clone git://github.com/raspberrypi/linux.git
- svn co file:///var/svn/rpi_linux/trunk
toolchain
- git clone https://github.com/raspberrypi/tools
Prepare SD
- Transfer the following files from the firmware/boot directory to the Raspberry pi /boot directory:
bootcode.bin fixup.dat start.elf
- cp firmware/hardfp/opt/ /media/root/opt/ -rf
build
- make mrproper
- cp arch/arm/configs/bcmrpi_defconfig .config
- export CCPREFIX=/path/to/your/compiler/binary/prefix-of-binary-
- make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig
- make ARCH=arm CROSS_COMPILE=${CCPREFIX}
libraries
- pi@raspberrypi:~$ ls /lib/
arm-linux-gnueabihf libip4tc.so.0 libnih.so.1.0.0
cpp libip4tc.so.0.1.0 libxtables.so.7
firmware libip6tc.so.0 libxtables.so.7.0.0
init libip6tc.so.0.1.0 lsb
klibc-sO6SifHCdmbehHGtm0y1yHu6vb0.so libipq.so.0 modprobe.d
ld-linux-armhf.so.3 libipq.so.0.0.0 modules
ld-linux.so.3 libiptc.so.0 systemd
libaudit.so.0 libiptc.so.0.0.0 terminfo
libaudit.so.0.0.0 libnih-dbus.so.1 udev
libauparse.so.0 libnih-dbus.so.1.0.0 xtables
libauparse.so.0.0.0 libnih.so.1
Update kernel in Raspbian
Get source
- $ git clone --depth=1 https://github.com/raspberrypi/linux
- $ sudo apt-get install bc
Raspberry Pi 1 (or Compute Module) Default Build Configuration
- $ cd linux
- $ KERNEL=kernel
- $ make bcmrpi_defconfig
Raspberry Pi 2 Default Build Configuration
- $ cd linux
- $ KERNEL=kernel7
- $ make bcm2709_defconfig
Build and install the kernel, modules and Device Tree blobs
- $ make zImage modules dtbs
- $ sudo make modules_install
- $ sudo cp arch/arm/boot/dts/*.dtb /boot/
- $ sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
- $ sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
- $ sudo scripts/mkknlimg arch/arm/boot/zImage /boot/$KERNEL.img
Note: On a Raspberry Pi 2, adding -j4 (make -j4 zImage modules dtbs) splits the work between all four cores, speeding up compilation significantly.
Cross Compile
- $ git clone https://github.com/raspberrypi/tools
- add /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to your $PATH
- make bcm2709_defconfig ARCH=arm
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4