Makefile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. include $(TOPDIR)/rules.mk
  3. include $(INCLUDE_DIR)/image.mk
  4. DEVICE_VARS += UBOOT_DEVICE_NAME
  5. define Build/Compile
  6. $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
  7. endef
  8. ### Image scripts ###
  9. define Build/boot-common
  10. # This creates a new folder copies the dtb (as rockchip.dtb)
  11. # and the kernel image (as kernel.img)
  12. rm -fR [email protected]
  13. mkdir -p [email protected]
  14. $(CP) $(IMAGE_KERNEL) [email protected]/kernel.img
  15. endef
  16. define Build/boot-script
  17. # Make an U-boot image and copy it to the boot partition
  18. mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $(if $(1),$(1),default).bootscript [email protected]/boot.scr
  19. endef
  20. define Build/pine64-img
  21. # Creates the final SD/eMMC images,
  22. # combining boot partition, root partition as well as the u-boot bootloader
  23. # Generate a new partition table in $@ with 32 MiB of
  24. # alignment padding for the u-boot-rockchip.bin (idbloader + u-boot) to fit:
  25. # http://opensource.rock-chips.com/wiki_Boot_option#Boot_flow
  26. #
  27. # U-Boot SPL expects the U-Boot ITB to be located at sector 0x4000 (8 MiB) on the MMC storage
  28. PADDING=1 $(SCRIPT_DIR)/gen_image_generic.sh \
  29. $@ \
  30. $(CONFIG_TARGET_KERNEL_PARTSIZE) [email protected] \
  31. $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
  32. 32768
  33. # Copy the u-boot-rockchip.bin to the image at sector 0x40
  34. dd if="$(STAGING_DIR_IMAGE)"/$(UBOOT_DEVICE_NAME)-u-boot-rockchip.bin of="$@" seek=64 conv=notrunc
  35. endef
  36. ### Devices ###
  37. define Device/Default
  38. PROFILES := Default
  39. KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
  40. KERNEL_LOADADDR :=
  41. BOOT_SCRIPT :=
  42. IMAGES := sysupgrade.img.gz
  43. IMAGE/sysupgrade.img.gz = boot-common | boot-script $$(BOOT_SCRIPT) | pine64-img | gzip | append-metadata
  44. DEVICE_DTS_DIR = $$(DTS_DIR)/rockchip
  45. DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1)))
  46. UBOOT_DEVICE_NAME = $(lastword $(subst _, ,$(1)))-$$(SOC)
  47. endef
  48. include $(SUBTARGET).mk
  49. $(eval $(call BuildImage))