diff --git a/device/gen_burn_image_sd.sh b/device/gen_burn_image_sd.sh new file mode 100755 index 000000000..c95c0c4cb --- /dev/null +++ b/device/gen_burn_image_sd.sh @@ -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 diff --git a/device/milkv-duo256m-musl-riscv64-sd/genimage.cfg b/device/milkv-duo256m-musl-riscv64-sd/genimage.cfg new file mode 100644 index 000000000..b406cea68 --- /dev/null +++ b/device/milkv-duo256m-musl-riscv64-sd/genimage.cfg @@ -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" + } +} diff --git a/device/milkv-duos-musl-riscv64-sd/genimage.cfg b/device/milkv-duos-musl-riscv64-sd/genimage.cfg new file mode 100644 index 000000000..5e7055ccf --- /dev/null +++ b/device/milkv-duos-musl-riscv64-sd/genimage.cfg @@ -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" + } +}