2 # Copyright (C) 2012-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-project.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
11 include $(TOPDIR
)/rules.mk
12 include $(INCLUDE_DIR
)/image.mk
14 KERNEL_LOADADDR
:= 0x00008000
19 -e
's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
20 -e
's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
21 $(BOOT_SCRIPT
).bootscript
> $@
-new.bootscript
22 mkimage
-A arm
-O linux
-T script
-C none
-a
0 -e
0 -d
$@
-new.bootscript
$@
-boot.scr
27 mkfs.fat
-C
$@.boot
$$(( $(CONFIG_TARGET_KERNEL_PARTSIZE
) * 1024 ))
28 $(foreach dts
,$(DEVICE_DTS
), mcopy
-i
$@.boot
$(KDIR
)/image-
$(dts
).dtb
::$(dts
).dtb
;)
29 mcopy
-i
$@.boot
$(IMAGE_KERNEL
) ::$(KERNEL_NAME
)
30 -mcopy
-i
$@.boot
$@
-boot.scr
::boot.scr
33 define Build
/boot-img-ext4
36 $(foreach dts
,$(DEVICE_DTS
), $(CP
) $(KDIR
)/image-
$(dts
).dtb
$@.boot
/$(dts
).dtb
;)
37 $(CP
) $(IMAGE_KERNEL
) $@.boot
/$(KERNEL_NAME
)
38 -$(CP
) $@
-boot.scr
$@.boot
/boot.scr
39 make_ext4fs
-J
-L kernel
-l
$(CONFIG_TARGET_KERNEL_PARTSIZE
)M
$@.bootimg
$@.boot
42 define Build
/sdcard-img
43 SIGNATURE
="$(IMG_PART_SIGNATURE)" \
44 .
/gen_mvebu_sdcard_img.sh
$@ \
45 $(if
$(UBOOT
),$(STAGING_DIR_IMAGE
)/$(UBOOT
)) \
46 c
$(CONFIG_TARGET_KERNEL_PARTSIZE
) $@.boot \
47 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE
) $(IMAGE_ROOTFS
)
50 define Build
/sdcard-img-ext4
51 SIGNATURE
="$(IMG_PART_SIGNATURE)" \
52 .
/gen_mvebu_sdcard_img.sh
$@ \
53 $(if
$(UBOOT
),$(STAGING_DIR_IMAGE
)/$(UBOOT
)) \
54 83 $(CONFIG_TARGET_KERNEL_PARTSIZE
) $@.bootimg \
55 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE
) $(IMAGE_ROOTFS
)
58 define Build
/omnia-medkit-initramfs
59 $(TAR
) -c
-T
/dev
/null
-f
$@
60 rm -rf
$(dir $(IMAGE_KERNEL
))boot
61 mkdir
-p
$(dir $(IMAGE_KERNEL
))boot
/boot
/
62 cp
$(KDIR
)/zImage-initramfs
$(dir $(IMAGE_KERNEL
))boot
/boot
/zImage
63 cp
$(KDIR
)/image-
$(DEVICE_DTS
).dtb
$(dir $(IMAGE_KERNEL
))boot
/boot
/dtb
64 $(TAR
) -rp
--numeric-owner
--owner
=0 --group
=0 --sort=name \
65 $(if
$(SOURCE_DATE_EPOCH
),--mtime
="@$(SOURCE_DATE_EPOCH)") \
66 --file
=$@
-C
$(dir $(IMAGE_KERNEL
))boot
/ .
69 define Build
/uDPU-firmware
70 (rm -fR
$@
-fw
; mkdir
-p
$@
-fw
)
71 $(CP
) $(BIN_DIR
)/$(IMAGE_PREFIX
)-initramfs.itb
$@
-fw
/recovery.itb
72 $(CP
) $@
-boot.scr
$@
-fw
/boot.scr
73 $(TAR
) -cvzp
--numeric-owner
--owner
=0 --group
=0 --sort=name \
74 $(if
$(SOURCE_DATE_EPOCH
),--mtime
="@$(SOURCE_DATE_EPOCH)") \
75 -f
$@
-fw
/rootfs.tgz
-C
$(TARGET_DIR
) .
76 $(TAR
) -cvzp
--numeric-owner
--owner
=0 --group
=0 --sort=name \
77 $(if
$(SOURCE_DATE_EPOCH
),--mtime
="@$(SOURCE_DATE_EPOCH)") \
78 -f
$@
-fw
/boot.tgz
-C
$@.boot .
79 $(TAR
) -cvzp
--numeric-owner
--owner
=0 --group
=0 --sort=name \
80 $(if
$(SOURCE_DATE_EPOCH
),--mtime
="@$(SOURCE_DATE_EPOCH)") \
81 -f
$(KDIR_TMP
)/$(IMAGE_PREFIX
)-firmware.tgz
-C
$@
-fw .
86 DEVICE_DTS
= $$(SOC
)-$(lastword
$(subst _
, ,$(1)))
87 DEVICE_DTS_DIR
:= $(DTS_DIR
)
88 BOARD_NAME
= $$(DEVICE_DTS
)
90 KERNEL
:= kernel-bin | append-dtb | uImage none
91 IMAGES
:= sysupgrade.bin
92 IMAGE
/factory.img
:= append-kernel | pad-to
$$$$(KERNEL_SIZE
) | append-ubi | pad-to
$$$$(PAGESIZE
)
93 IMAGE
/sysupgrade.bin
:= sysupgrade-tar | append-metadata
94 SUPPORTED_DEVICES
= $(subst _
,$(comma
),$(1))
99 DEVICE_VARS
+= BOOT_SCRIPT UBOOT
101 define Device
/Default-arm64
102 BOOT_SCRIPT
:= generic-arm64
103 DEVICE_DTS_DIR
:= $(DTS_DIR
)/marvell
104 IMAGES
:= sdcard.img.gz
105 IMAGE
/sdcard.img.gz
:= boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata
110 define Device
/NAND-128K
114 VID_HDR_OFFSET
:= 2048
117 define Device
/NAND-256K
122 define Device
/NAND-512K
127 ifeq ($(SUBTARGET
),cortexa9
)
131 ifeq ($(SUBTARGET
),cortexa53
)
135 ifeq ($(SUBTARGET
),cortexa72
)
139 $(eval
$(call BuildImage
))