mirror of
https://github.com/linux-sunxi/meta-sunxi.git
synced 2024-12-26 13:08:21 +01:00
sdimage: add support for sun50i sunxi boards
Modify sdcard_image-sunxi bbclass to support both sun50i and older SoC families. Major changes are as follows: - update comments: disk layout info - increase boot partition size: aarch64 unified kernels can be large - kernel image in boot partition: replace explicit name by KERNEL_IMAGETYPE - SPL image: replace explicit name by SPL_BINARY - implement flexible DTB file location in boot partition -- e.g. by defaut sun50i u-boot looks for dtb in allwinner subdirectory -- follow kernel dtb naming conventions, e.g. allwinner/<board>.dtb - copy aarch64 u-boot image to image -- sunxi arm boards use unified u-boot/spl image -- sunxi aarch64 boards use two different images Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
This commit is contained in:
parent
e85a48c611
commit
416af351cb
@ -7,8 +7,8 @@ inherit image_types
|
|||||||
# The disk layout used is:
|
# The disk layout used is:
|
||||||
#
|
#
|
||||||
# 0 -> 8*1024 - reserverd
|
# 0 -> 8*1024 - reserverd
|
||||||
# 8*1024 -> 32*1024 -
|
# 8*1024 -> - arm combined spl/u-boot or aarch64 spl
|
||||||
# 32*1024 -> 2048*1024 -
|
# 40*1024 -> - aarch64 u-boot
|
||||||
# 2048*1024 -> BOOT_SPACE - bootloader and kernel
|
# 2048*1024 -> BOOT_SPACE - bootloader and kernel
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -20,7 +20,7 @@ IMAGE_TYPEDEP_sunxi-sdimg = "${SDIMG_ROOTFS_TYPE}"
|
|||||||
BOOTDD_VOLUME_ID ?= "${MACHINE}"
|
BOOTDD_VOLUME_ID ?= "${MACHINE}"
|
||||||
|
|
||||||
# Boot partition size [in KiB]
|
# Boot partition size [in KiB]
|
||||||
BOOT_SPACE ?= "20480"
|
BOOT_SPACE ?= "40960"
|
||||||
|
|
||||||
# First partition begin at sector 2048 : 2048*1024 = 2097152
|
# First partition begin at sector 2048 : 2048*1024 = 2097152
|
||||||
IMAGE_ROOTFS_ALIGNMENT = "2048"
|
IMAGE_ROOTFS_ALIGNMENT = "2048"
|
||||||
@ -64,17 +64,23 @@ IMAGE_CMD_sunxi-sdimg () {
|
|||||||
rm -f ${WORKDIR}/boot.img
|
rm -f ${WORKDIR}/boot.img
|
||||||
mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
|
mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
|
||||||
|
|
||||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin ::uImage
|
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
|
||||||
|
|
||||||
# Copy device tree file
|
# Copy device tree file
|
||||||
if test -n "${KERNEL_DEVICETREE}"; then
|
if test -n "${KERNEL_DEVICETREE}"; then
|
||||||
for DTS_FILE in ${KERNEL_DEVICETREE}; do
|
for DTS_FILE in ${KERNEL_DEVICETREE}; do
|
||||||
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
|
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
|
||||||
|
DTS_DIR_NAME=`dirname ${DTS_FILE}`
|
||||||
if [ -e ${DEPLOY_DIR_IMAGE}/"${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
|
if [ -e ${DEPLOY_DIR_IMAGE}/"${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
|
||||||
|
|
||||||
|
if [ ${DTS_FILE} != ${DTS_BASE_NAME}.dtb ]; then
|
||||||
|
mmd -i ${WORKDIR}/boot.img ::/${DTS_DIR_NAME}
|
||||||
|
fi
|
||||||
|
|
||||||
kernel_bin="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin`"
|
kernel_bin="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin`"
|
||||||
kernel_bin_for_dtb="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MACHINE},g;s,\.dtb$,.bin,g"`"
|
kernel_bin_for_dtb="`readlink ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb | sed "s,$DTS_BASE_NAME,${MACHINE},g;s,\.dtb$,.bin,g"`"
|
||||||
if [ $kernel_bin = $kernel_bin_for_dtb ]; then
|
if [ $kernel_bin = $kernel_bin_for_dtb ]; then
|
||||||
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_BASE_NAME}.dtb
|
mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb ::/${DTS_FILE}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -104,7 +110,15 @@ IMAGE_CMD_sunxi-sdimg () {
|
|||||||
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
|
dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#write u-boot and spl at the beginint of sdcard in one shot
|
# write u-boot-spl at the begining of sdcard in one shot
|
||||||
dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${SDIMG} bs=1024 seek=8 conv=notrunc
|
SPL_FILE=$(basename ${SPL_BINARY})
|
||||||
|
dd if=${DEPLOY_DIR_IMAGE}/${SPL_FILE} of=${SDIMG} bs=1024 seek=8 conv=notrunc
|
||||||
|
}
|
||||||
|
|
||||||
|
# write uboot.itb for arm64 boards
|
||||||
|
IMAGE_CMD_sunxi-sdimg_append_sun50i () {
|
||||||
|
if [ -e "${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY}" ]
|
||||||
|
then
|
||||||
|
dd if=${DEPLOY_DIR_IMAGE}/${UBOOT_BINARY} of=${SDIMG} bs=1024 seek=40 conv=notrunc
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user