https://harmonyos.51cto.com
一、OpenHarmony手动编译Linux内核
1.首次编译标准系统
./build.sh --product-name Hi3516DV300 --ccache
2.编译完成在编译的内核
在OpenHarmony-v3.1-Beta/out/KERNEL_OBJ/kernel/src_tmp/linux-5.10目录下
配置编译环境变量
export OHOS_ROOT=/home/weimin/OpenHarmony/OpenHarmony-v3.1-Beta
export PATH=$OHOS_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm/bin:$PATH
export PATH=$OHOS_ROOT/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin:$PATH
export MAKE_OPTIONS="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang"
export PRODUCT_PATH=vendor/hisilicon/Hi3516DV300
编译内核
make ${MAKE_OPTIONS} menuconfig hi3516dv300_standard_defconfig
或者
make ${MAKE_OPTIONS} menuconfig hi3516dv300_small_defconfig
make ${MAKE_OPTIONS} uImage
编译完成在out/KERNEL_OBJ/kernel/src_tmp/linux-5.10/arch/arm/boot目录下生成uImage,zImage-dtb,zImage和Image等镜像文件。
二、手动打包ramdisk镜像
进入ramdisk的文件目录执行如下命令:
进入ramdisk的文件目录执行如下命令:
find . | cpio -c -o -v |gzip >../ramdisk.img
三、打包ramdisk.img和zImage-dtb生成boot.img
ohos.its文件内容如下:
/dts-v1/;
/ {
description = "U-Boot uImage source file for Hi3516DV300";
#address-cells = <1>;
images {
kernel@1 {
description = "Linux kernel for Hi3516DV300";
data = /incbin/("./zImage-dtb");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0x82000000>;
entry = <0x82000000>;
};
ramdisk@1 {
description = "ohos Ramdisk Image";
data = /incbin/("./ramdisk.img");
type = "ramdisk";
arch = "arm";
os = "linux";
compression = "none";
load = <0x84000000>;
entry = <0x84000000>;
};
};
configurations {
default = "conf@boot";
conf@boot {
description = "booting ARM Linux Kernel Image";
kernel = "kernel@1";
ramdisk = "ramdisk@1";
};
};
};
data = /incbin/(“./zImage-dtb”);指定zImage文件的路径
data = /incbin/(“./ramdisk.img”); 指定ramdisk文件的路径
如果ohos.its没有修改,将ohos.its、ramdisk.img和zImage-dtb文件放入同一目录下,执行下面命令生成boot.img:
mkimage -f ohos.its boot.img
https://harmonyos.51cto.com
文章版权声明
1 原创文章作者:钱来风,如若转载,请注明出处: https://www.52hwl.com/91416.html
2 温馨提示:软件侵权请联系469472785#qq.com(三天内删除相关链接)资源失效请留言反馈
3 下载提示:如遇蓝奏云无法访问,请修改lanzous(把s修改成x)
4 免责声明:本站为个人博客,所有软件信息均来自网络 修改版软件,加群广告提示为修改者自留,非本站信息,注意鉴别