Makefile 1.9 KB

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