"Kernel" 修訂間的差異

出自 flip the world
前往: 導覽搜尋
(已建立頁面,內容為 "== 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

  1. $ git clone --depth=1 https://github.com/raspberrypi/linux
  2. $ sudo apt-get install bc

Raspberry Pi 1 (or Compute Module) Default Build Configuration

  1. $ cd linux
  2. $ KERNEL=kernel
  3. $ make bcmrpi_defconfig

Raspberry Pi 2 Default Build Configuration

  1. $ cd linux
  2. $ KERNEL=kernel7
  3. $ make bcm2709_defconfig

Build and install the kernel, modules and Device Tree blobs

  1. $ make zImage modules dtbs
  2. $ sudo make modules_install
  3. $ sudo cp arch/arm/boot/dts/*.dtb /boot/
  4. $ sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
  5. $ sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
  6. $ 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

  1. $ git clone https://github.com/raspberrypi/tools
  2. add /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to your $PATH
  3. make bcm2709_defconfig ARCH=arm
  4. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4

reference