close

CubieBoard 公司所釋出的 Kernel 版本為 3.4.79 (CB2) 和 3.4.39 (CB4),要使用在較新的 OS 時,都會出現不相容的問題,如 CONSOLE 無法登入,會出現很多錯誤訊息等等的問題。

所以研究了一下如何建立新的 Kernel。

目前找到三種方法可建立新的 Kermel

1.使用 Buildroot 建立,可參考  使用 Buildroot 建構 Cubieboard2 上自己的 Linux

2.使用  Yocto 建立,可參考  使用 Yocto 建構 Cubieboard2 上自己的 Linux

3.由Linux  Kernel 源始碼直接建立

這篇文章主要說明的是第三種方式。

由Linux  Kernel 源始碼直接建立

我使用的環境為 Ubuntu 18.04

a. 安裝所需軟體

    $ sudo apt install wget make gcc flex bison gcc-arm-linux-gnueabihf libncurses5-dev bc

b. 由  The Linux Kernel Archives 下載所想要的版本的源始碼

    $ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.14.11.tar.xz

image

c. 解壓縮

    $ tar -xvf ./linux-5.14.11.tar.xz

    $ cd linux-5.14.11

d. 設置

$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig 

如要修改設定可下以下命令

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

e. 建置 zImage

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 zImage

zImage Kernel 會產生在 linux-5.14.11/arch/arm/boot 目錄下

f. Devicetree

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 dtbs

Devicetree 會產生在 linux-5.14.11/arch/arm/boot/dts 目錄下

f. 建置 Module

ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make -j4 modules
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=<any-path-you-like> make modules modules_install

細節可參考  Mainline Kernel Howto - linux-sunxi.org

 

要注意的是這個 Kernel 不支援大多數的硬體功能,只能把 CB2、CB4 當作一般的電腦用,手上只有 CB2 和 CB4,所以只在這兩個平台上驗證過,但理論上所有 Sunxi SoC 系列都可使用這個方式所建立的 Kernel。

arrow
arrow
    文章標籤
    CB2 CB4 cubieboard Kernel
    全站熱搜
    創作者介紹
    創作者 山哥 的頭像
    山哥

    遺忘國度的山哥

    山哥 發表在 痞客邦 留言(0) 人氣()