device: add genimage config files

Signed-off-by: carbon <carbon@milkv.io>
This commit is contained in:
carbon
2024-06-15 20:48:27 +08:00
parent b6a5f4a410
commit 1de05a8fa9
3 changed files with 110 additions and 0 deletions

44
device/gen_burn_image_sd.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# milkv sd image generator
# usage
if [ "$#" -ne "1" ]; then
echo "usage: ${0} OUTPUT_DIR"
echo ""
echo " The script is used to create a sdcard image with two partitions, "
echo " one is fat32 with 128MB, the other is ext4 with 256MB."
echo " You can modify the capacities in genimage cfg as you wish!"
echo " genimage cfg: milkv/genimage-milkv-duo.cfg"
echo ""
echo "Note: Please backup you sdcard files before using this image!"
exit
fi
echo "BR_DIR: $BR_DIR"
echo "BR_BOARD: $BR_BOARD"
# genimage command in buildroot host bin
BR_HOST_BIN="${BR_DIR}/output/${BR_BOARD}/host/bin"
if [ ! -d ${BR_HOST_BIN} ]; then
echo "host/bin not found, check buildroot output dir!"
exit 1
fi
export PATH=${BR_HOST_BIN}:${PATH}
output_dir=$1
echo ${output_dir}
pushd ${output_dir}
[ -d tmp ] && rm -rf tmp
genimage --config ${TOP_DIR}/device/${MV_BOARD}/genimage.cfg --rootpath fs/ --inputpath ${PWD} --outputpath ${PWD}
if [ $? -eq 0 ]; then
echo "gnimage for ${MV_BOARD} success!"
else
echo "gnimage for ${MV_BOARD} failed!"
fi
popd

View File

@ -0,0 +1,33 @@
image boot.vfat {
vfat {
label = "boot"
files = {
"fip.bin",
"rawimages/boot.sd",
}
}
size = 128M
}
image rootfs.ext4 {
ext4 {
label = "rootfs"
}
size = 768M
}
image milkv-duo256m-musl-riscv64-sd.img {
hdimage {
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
}

View File

@ -0,0 +1,33 @@
image boot.vfat {
vfat {
label = "boot"
files = {
"fip.bin",
"rawimages/boot.sd",
}
}
size = 128M
}
image rootfs.ext4 {
ext4 {
label = "rootfs"
}
size = 768M
}
image milkv-duos-musl-riscv64-sd.img {
hdimage {
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
}