openwrt/target/linux/layerscape/image/Makefile
Mathew McBride 68a4c60b5c layerscape: armv8_64b: add Traverse Ten64 NAND variant
The Ten64 board[1] is based around NXP's Layerscape LS1088A SoC.
It is capable of booting both standard Linux distributions
from disk devices, using EFI, and booting OpenWrt
from NAND.

See the online manual for more information, including the
flash layout[2].

This patchset adds support for generating Ten64 images
for NAND boot.
For disk boot, one can use the EFI support that was
recently added to the armvirt target.

We previously supported NAND users by building
inside our armvirt/EFI target[3], but this approach
is not suitable for OpenWrt upstream. Users who
used our supplied NAND images will be able to upgrade
to this via sysupgrade.

Signed-off-by: Mathew McBride <matt@traverse.com.au>

[1] - https://www.traverse.com.au/hardware/ten64
[2] - https://ten64doc.traverse.com.au/hardware/flash/
[3] - Example:
285e4360e1
(cherry picked from commit af0546da34)
2023-07-26 13:36:58 +02:00

96 lines
3.0 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2016 Jiang Yutang <jiangyutang1978@gmail.com>
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
LS_SD_KERNELPART_SIZE = 40
LS_SD_KERNELPART_OFFSET = 16
LS_SD_ROOTFSPART_OFFSET = 64
LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \
$(CONFIG_TARGET_ROOTFS_PARTSIZE)))))
# The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs
LS_SYSUPGRADE_IMAGE_SIZE = 49m
define Image/Prepare
# Build .dtb for all boards we may run on
$(foreach dts,$(DEVICE_DTS_LIST),
$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
)
endef
define Build/ls-clean
rm -f $@
endef
define Build/ls-append
dd if=$(STAGING_DIR_IMAGE)/$(1) >> $@
endef
define Build/ls-append-dtb
dd if=$(DTS_DIR)/$(1).dtb >> $@
endef
define Build/ls-append-kernel
mkdir -p $@.tmp && \
cp $(IMAGE_KERNEL) $@.tmp/fitImage && \
make_ext4fs -J -L kernel -l "$(LS_SD_KERNELPART_SIZE)M" \
$(if $(SOURCE_DATE_EPOCH),-T $(SOURCE_DATE_EPOCH)) \
"$@.kernel.part" "$@.tmp" && \
dd if=$@.kernel.part >> $@ && \
rm -rf $@.tmp && \
rm -f $@.kernel.part
endef
define Build/ls-append-sdhead
./gen_sdcard_head_img.sh $(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img \
$(LS_SD_KERNELPART_OFFSET) $(LS_SD_KERNELPART_SIZE) \
$(LS_SD_ROOTFSPART_OFFSET) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
dd if=$(STAGING_DIR_IMAGE)/$(1)-sdcard-head.img >> $@
endef
define Build/traverse-fit
./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \
-v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-C gzip -c 1 -c 2 \
-d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043s.dtb \
-D "Traverse_LS1043S" -n "ls1043s" -a $(FDT_LOADADDR) -c 1 \
-d $(DEVICE_DTS_DIR)/freescale/traverse-ls1043v.dtb \
-D "Traverse_LS1043V" -n "ls1043v" -a $(FDT_LOADADDR) -c 2
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv -f $@.new $@
endef
define Build/traverse-fit-ls1088
./mkits-multiple-config.sh -o $@.its -A $(LINUX_KARCH) \
-v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-C gzip -c 1 -c 2 \
-d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \
-D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \
-d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \
-D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv -f $@.new $@
endef
define Device/fix-sysupgrade
DEVICE_COMPAT_VERSION := 2.0
DEVICE_COMPAT_MESSAGE := DTB was added to sysupgrade. Image format is different. \
To use sysupgrade You need to change firmware partition in bootargs to "49m@0xf00000(firmware)" and saveenv. \
After that, You can use "sysupgrade -F".
endef
define Device/rework-sdcard-images
DEVICE_COMPAT_VERSION := 2.0
DEVICE_COMPAT_MESSAGE := SD-card images were changed to squashfs + ext4 overlay combined images. \
It is required to flash the entire sd-card again and manually copy config.
endef
include $(SUBTARGET).mk
$(eval $(call BuildImage))