diff --git a/board/phytium/genimage-tools/dtc b/board/phytium/genimage-tools/dtc new file mode 100755 index 00000000..eb7d07d5 Binary files /dev/null and b/board/phytium/genimage-tools/dtc differ diff --git a/board/phytium/genimage-tools/genimage-sd.cfg b/board/phytium/genimage-tools/genimage-sd.cfg index b1edbe4d..823c0876 100644 --- a/board/phytium/genimage-tools/genimage-sd.cfg +++ b/board/phytium/genimage-tools/genimage-sd.cfg @@ -1,62 +1,32 @@ -image efi-part.vfat { - vfat { - file EFI { - image = "efi-part/EFI" - } - file Image { - image = "Image" - } - files = { - "e2000d-chillipi-edu-board.dtb", - "e2000d-demo-board.dtb", - "e2000d-miniitx-board.dtb", - "e2000d-power-board.dtb", - "e2000q-come-board.dtb", - "e2000q-demo-board.dtb", - "e2000q-edu-board.dtb", - "e2000q-hanwei-board.dtb", - "e2000q-miniitx-board.dtb", - "e2000q-vpx-board.dtb", - "e2000s-demo-board.dtb", - "phytiumpi_firefly.dtb" - } - - } - - size = 400M -} - image rootfs.ext4 { ext4 { use-mke2fs = true } - size = 10G + size = 5G mountpoint = "/" } image sdcard.img { hdimage { - partition-table-type = "gpt" } partition uboot { in-partition-table = no offset = 0 image = "uboot.bin" - size = 20M + size = 4M } - partition boot { - image = "efi-part.vfat" - partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b - offset = 20M - bootable = true + in-partition-table = no + offset = 4M + image = "fitImage" + size = 60M } partition root { - partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 - partition-uuid = "0a52c129-7e0f-43ad-989f-d96b07ccdbb2" + partition-type = 0x83 image = "rootfs.ext4" - size = 11G + size = 6G } + } diff --git a/board/phytium/genimage-tools/genimage.sh b/board/phytium/genimage-tools/genimage.sh index ea55f2b7..16bc6df9 100755 --- a/board/phytium/genimage-tools/genimage.sh +++ b/board/phytium/genimage-tools/genimage.sh @@ -10,7 +10,7 @@ EOF } # Parse arguments and put into argument list of the script -opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $? +opts="$(getopt -n "${0##*/}" -o c:d: -- "$@")" || exit $? eval set -- "$opts" while true ; do @@ -18,6 +18,9 @@ while true ; do -c) GENIMAGE_CFG="${2}"; shift 2 ;; + -d) + DTB="${2}"; + shift 2 ;; --) # Discard all non-option parameters shift 1; break ;; @@ -35,6 +38,16 @@ GENIMAGE_TMP=${GENIMAGE_TMP-${WORKDIR}/genimage.tmp} INPUTPATH=${INPUTPATH-${WORKDIR}/input} OUTPUTPATH=${OUTPUTPATH-${WORKDIR}/images} +# sd image +if grep -q "fitImage" ${GENIMAGE_CFG}; then + if [ ! -e ${INPUTPATH}/Image.gz ]; then + cat ${INPUTPATH}/Image | gzip -n -f -9 > ${INPUTPATH}/Image.gz + fi + cp ${WORKDIR}/kernel.its ${INPUTPATH}/kernel.its + sed -i "s/phytiumpi_firefly.dtb/${DTB}/g" ${INPUTPATH}/kernel.its + mkimage_phypi -f ${INPUTPATH}/kernel.its ${INPUTPATH}/fitImage +fi + rm -rf "${GENIMAGE_TMP}" trap 'rm -rf "${GENIMAGE_TMP}"' EXIT diff --git a/board/phytium/genimage-tools/kernel.its b/board/phytium/genimage-tools/kernel.its new file mode 100755 index 00000000..ea6a0898 --- /dev/null +++ b/board/phytium/genimage-tools/kernel.its @@ -0,0 +1,59 @@ +/* + * Compilation: + * mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb + * + * Files in linux build dir: + * - arch/arm/boot/Image (zImage-old-ok) + * - arch/arm/boot/dts/ft.dtb + * + * fatload usb 0:1 0x90100000 fit_kernel_dtb.itb + * bootm 0x90100000#e2000 + * + */ + +/dts-v1/; +/ { + description = "U-Boot fitImage for Phytium Phytiumpi"; + #address-cells = <1>; + + images { + kernel { + description = "Linux kernel"; + data = /incbin/("Image.gz"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "gzip"; + load = <0x80080000>; + entry = <0x80080000>; + hash-1 { + algo = "sha1"; + }; + }; + + fdt-phytium { + description = "FDT phytiumpi"; + data = /incbin/("phytiumpi_firefly.dtb"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + hash-1 { + algo = "sha1"; + }; + }; + }; + + configurations { + default = "phytium@cecport"; + + phytium { + description = "phytimpi"; + kernel = "kernel"; + fdt = "fdt-phytium"; + hash-1 { + algo = "sha1"; + }; + }; + + }; +}; diff --git a/board/phytium/genimage-tools/mkimage_phypi b/board/phytium/genimage-tools/mkimage_phypi new file mode 100755 index 00000000..0846e301 Binary files /dev/null and b/board/phytium/genimage-tools/mkimage_phypi differ