Sd卡替换linux内核或者dtb设备树的方法

!请确保至少编译过项目一次!
在duo-buildroot-sdk/ramdisk/build/cv1800b_milkv_duo_sd/workspace找到multi.its
在任意位置建立个文件夹放入multi.its,然后新建两个文件
Makefile

default: Image.lzma cv1800b_milkv_duo_sd.dtb
	mkimage -f multi.its boot.sd
dump:
	./dump.sh multi.its

dump.sh

image_data=($(grep 'data = /incbin/("./.*");' $1 | awk -F'["]' '{print $2}'))

i=$((0))
for item in "${image_data[@]}"
do
    echo find[$i]:{$item}
    dumpimage boot.sd -T flat_dt -p $i -o $item
    i=$((i + 1))
done

将sd卡的boot目录里的boot.sd拿出来,放到同一目录下,输入:
make dump可以解包出:Image.lzma和cv1800b_milkv_duo_sd.dtb

其中cv1800b_milkv_duo_sd.dtb是编译好的设备树,Image.lzma是内部有Image内核的内核文件
可以自行替换两个文件,然后输入make获得重新打包的boot.sd

将boot.sd替换sd卡的文件即可完成

Hello, what does this exactly do and why would one need to do this?

with the tutorial,you can compile dts or kernel individually,and replace one simply.
4 example,once you compile a dtb,and replace boot.sd,it will take little time.
but if you use the sdk build bash,it will take a lot of time.

in sum,for people change the device tree,this methord will save the time

1 Like

Thank you for your quick response and for the explanation.
Looks very much like it will become a wiki page with this and similar tweaks gathered in one place.