라즈비안 리눅스에서 커널을 빌드 하기 위한 방법이다.
아래 경로를 참고하면 라즈베리파이 공식사이트에서 방법을 제공한다.
https://www.raspberrypi.com/documentation/computers/linux_kernel.html
Raspberry Pi Documentation - The Linux kernel
The official documentation for Raspberry Pi computers and microcontrollers
www.raspberrypi.com
공식사이트에서는 커맨드 형식으로 타이핑 해야되서 자주사용하기에는 불편하다.
이럴 경우, 임베디드 개발 시 빌드 쉘 스크립트를 사용하면 된다.
라즈비안 리눅스 커널 코드의 경우, 아래 경로에서 git clone 가능하다.
https://github.com/raspberrypi/linux
GitHub - raspberrypi/linux: Kernel source tree for Raspberry Pi Foundation-provided kernel builds. Issues unrelated to the linux
Kernel source tree for Raspberry Pi Foundation-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/ - GitHub - ras...
github.com
Build Sheel Script 는 아래와 같다. apt-get or apt update 및 upgrade는 필수 이다.
#!/bin/bash
echo "configure build output path"
KERNEL_TOP_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
OUTPUT="$KERNEL_TOP_PATH/out"
echo "$OUTPUT"
KERNEL=kernel7
BUILD_LOG="$KERNEL_TOP_PATH/rpi_build_log.txt"
echo "move kernel source"
cd linux
echo "make defconfig"
make O=$OUTPUT bcm2709_defconfig
echo "kernel build"
make O=$OUTPUT zImage modules dtbs -j4 2>&1 | tee $BUILD_LOG
라즈베리파이4에 라즈비안 21.10 쯤 버전으로 5.10.y 커널로 빌드를 한다면
kernel7l, bcm2711_defconfig 로 수정하여 빌드하면 된다.
아래는 빌드된 이미즈를 보드에 설치하는 script 이다.
#!/bin/bash
KERNEL_TOP_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
OUTPUT="$KERNEL_TOP_PATH/out"
echo "$OUTPUT"
cd linux
make O=$OUTPUT modules_install
cp $OUTPUT/arch/arm/boot/dts/*.dtb /boot/
cp $OUTPUT/arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
cp $OUTPUT/arch/arm/boot/zImage /boot/kernel7l.img
'Embedded > Raspberry Pi' 카테고리의 다른 글
[Raspberry Pi] 라즈베리파이 Username 'pi' 변경 하기 (0) | 2022.01.26 |
---|---|
[Raspberry Pi] 라즈베리파이 라즈비안 커널 이미지 라이팅 (0) | 2022.01.23 |
[Raspberry Pi] 라즈베리파이 apt-get update upgrade 문제 해결하기 (0) | 2022.01.20 |
[Raspberry Pi] 라즈베리파이 WiFi 끊김 문제 해결하기 2 (0) | 2022.01.20 |
[Raspberry Pi] 라즈베리파이 WiFi IP 고정으로 사용하기 (0) | 2022.01.20 |