交叉編譯龍芯平臺的uboot 和 kernel
阿新 • • 發佈:2020-12-10
u-boot 2013
export ARCH=mips
export CROSS_COMPILE=mips64el-linux-
如果想指定編譯目錄:
export BUILD_DIR=/tmp/build
或
make -O=/tmp/build
make ls2k_pai_config
make
u-boot 2019 (gcc-9.1 mips64el)
export ARCH=mips export CROSS_COMPILE=mips64el-linux- cp configs/ls2k_pai_config .config make 或 make ls2k_pai_defconfig make
kernel 4.19(gcc-9.1 mips64el)
export ARCH=mips export CROSS_COMPILE=mips64el-linux- cp arch/mips/configs/ls2k_pai_config .config 或者 make ls2k_pai_config make 說明:make 之後會生成 vmlinux, 生成 vmlinuz 需要vmlinux 中的開始地址,通過 objdump -f vmlinux 獲取。 由於獲取開始地址的過程指令碼中是以英文來匹配的,如果是中文環境可能會導致匹配不對獲取不到開始地址, 從而生成vmlinuz 出錯。 故需要設定語言環境為英文 export LANG=c 生成uImage 需要 u-boot 編譯生成的 tools/mkimage 工具 export PATH=$PATH:/home/loongson/u-boot-2019.10/tools make uImage 安裝核心(預設是在/boot/) make install 安裝模組檔案(預設是在/usr/lib/modules) make modules_install 或者 指定自定義安裝路徑 make INSTALL_PATH=../kernel_5.4/ install make INSTALL_MOD_PATH=../kernel_5.4/ modules_install
在龍芯的電腦環境製作initrd
redhat 系os: 製作ram disk # mkinitrd initr.3.10.0.img 3.10.0 製作 initramfs(推薦用這個) # cd /boot # dracut initramfs-3.10.0.img 3.10.0 debian 系os: 4.19.26 為當前編譯的核心號mkinitramfs會根據這個名去/lib/moudules/4.19.26 下打包核心模組檔案 # mkinitramfs 4.19.26 -o /boot/initrd.img-4.19.26 現在的發行版基本上都是用initramfs 代替 ram disk。