brcm2708: remove duplicated gzip from image generation
[lede.git] / target / linux / brcm2708 / image / Makefile
1
2 # Copyright (C) 2012-2015 OpenWrt.org
3 # Copyright (C) 2016-2017 LEDE project
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
10 include $(INCLUDE_DIR)/host.mk
11
12 FAT32_BLOCK_SIZE=1024
13 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
14
15 define Build/Compile
16         $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
17 endef
18
19 ### Image scripts ###
20 define Build/kernel-img
21         perl $(LINUX_DIR)/scripts/mkknlimg $@ $@.tmp
22         mv $@.tmp $@
23 endef
24
25 define Build/boot-img
26         rm -f $@.boot
27         mkfs.fat -C $@.boot $(FAT32_BLOCKS)
28         mcopy -i $@.boot $(KDIR)/COPYING.linux ::
29         mcopy -i $@.boot $(KDIR)/bootcode.bin ::
30         mcopy -i $@.boot $(KDIR)/LICENCE.broadcom ::
31         mcopy -i $@.boot $(KDIR)/start.elf ::
32         mcopy -i $@.boot $(KDIR)/start_cd.elf ::
33         mcopy -i $@.boot $(KDIR)/fixup.dat ::
34         mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
35         mcopy -i $@.boot cmdline.txt ::
36         mcopy -i $@.boot config.txt ::
37         mcopy -i $@.boot $(IMAGE_KERNEL) ::kernel.img
38         $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
39         mmd -i $@.boot ::/overlays
40         mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
41         mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
42 endef
43
44 define Build/sdcard-img
45         ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
46                 $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
47 endef
48
49 ### Devices ###
50 define Device/Default
51   FILESYSTEMS := ext4
52   KERNEL := kernel-bin | kernel-img
53   IMAGES := sdcard.img
54   IMAGE/sdcard.img := boot-img | sdcard-img
55 endef
56
57 define Device/rpi
58   DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
59   DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w
60   DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini
61 endef
62 ifeq ($(SUBTARGET),bcm2708)
63   TARGET_DEVICES += rpi
64 endif
65
66 define Device/rpi-2
67   DEVICE_TITLE := Raspberry Pi 2 B
68   DEVICE_DTS := bcm2709-rpi-2-b
69 endef
70 ifeq ($(SUBTARGET),bcm2709)
71   TARGET_DEVICES += rpi-2
72 endif
73
74 define Device/rpi-3
75   DEVICE_TITLE := Raspberry Pi 3 B/CM
76   DEVICE_DTS := bcm2710-rpi-3-b bcm2710-rpi-cm3
77   DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio kmod-brcmfmac wpad-mini
78 endef
79 ifeq ($(SUBTARGET),bcm2710)
80   TARGET_DEVICES += rpi-3
81 endif
82
83 $(eval $(call BuildImage))