brcm2708: Add wifi driver, firmware and NVRAM for RPi1
[oweals/openwrt.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
11 FAT32_BLOCK_SIZE=1024
12 FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
13
14 define Build/Compile
15         $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
16 endef
17
18 ### Image scripts ###
19 define Build/kernel-img
20         perl $(LINUX_DIR)/scripts/mkknlimg $@ $@.tmp
21         mv $@.tmp $@
22 endef
23
24 define Build/boot-img
25         rm -f $@.boot
26         mkfs.fat -C $@.boot $(FAT32_BLOCKS)
27         mcopy -i $@.boot $(KDIR)/COPYING.linux ::
28         mcopy -i $@.boot $(KDIR)/bootcode.bin ::
29         mcopy -i $@.boot $(KDIR)/LICENCE.broadcom ::
30         mcopy -i $@.boot $(KDIR)/start.elf ::
31         mcopy -i $@.boot $(KDIR)/start_cd.elf ::
32         mcopy -i $@.boot $(KDIR)/fixup.dat ::
33         mcopy -i $@.boot $(KDIR)/fixup_cd.dat ::
34         mcopy -i $@.boot cmdline.txt ::
35         mcopy -i $@.boot config.txt ::
36         mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
37         $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
38         mmd -i $@.boot ::/overlays
39         mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
40         mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
41 endef
42
43 define Build/sdcard-img
44         ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \
45                 $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
46 endef
47
48 ### Devices ###
49 define Device/Default
50   KERNEL := kernel-bin | kernel-img
51   KERNEL_IMG := kernel.img
52   IMAGES := sdcard.img.gz
53   IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata
54 endef
55
56 define Device/rpi
57   DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW
58   DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w
59   SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,compute-module-1 raspberrypi,model-b-rev2 raspberrypi,model-zero raspberrypi,model-zero-w
60   DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 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 2B/3B/3B+/3CM
68   DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3
69   SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,3-model-b-plus raspberrypi,compute-module-3
70   DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-firmware-43455-sdio brcmfmac-board-rpi2 brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini
71 endef
72 ifeq ($(SUBTARGET),bcm2709)
73   TARGET_DEVICES += rpi-2
74 endif
75
76 define Device/rpi-3
77   KERNEL_IMG := kernel8.img
78   DEVICE_TITLE := Raspberry Pi 3B/3B+
79   DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus
80   SUPPORTED_DEVICES := rpi-3-b rpi-3-b-plus raspberrypi,3-model-b raspberrypi,3-model-b-plus
81   DEVICE_PACKAGES := brcmfmac-firmware-43455-sdio brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini
82 endef
83 ifeq ($(SUBTARGET),bcm2710)
84   TARGET_DEVICES += rpi-3
85 endif
86
87 $(eval $(call BuildImage))