From 04dea8b4210d6f160791a621ca1bb1c31da9171f Mon Sep 17 00:00:00 2001 From: Ycarus Date: Wed, 8 Aug 2018 15:36:00 +0200 Subject: [PATCH] Fix RPI wifi support --- build.sh | 2 +- .../firmware/brcmfmac-board-rpi/Makefile | 88 +++++++++++++++++++ root/target/linux/brcm2708/Makefile | 1 - root/target/linux/brcm2708/image/Makefile | 88 +++++++++++++++++++ 4 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 root/package/firmware/brcmfmac-board-rpi/Makefile create mode 100644 root/target/linux/brcm2708/image/Makefile diff --git a/build.sh b/build.sh index dfdb93bd..da6c1469 100755 --- a/build.sh +++ b/build.sh @@ -48,7 +48,7 @@ fi #_get_repo source https://github.com/ysurac/openmptcprouter-source "master" #_get_repo "$OMR_TARGET/source" https://github.com/lede-project/source.git "3db9d6e57def2912314c7ce0bc0c282f313ed654" -_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "openwrt-18.06" +_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "master" _get_repo feeds/packages https://github.com/openwrt/packages "openwrt-18.06" #_get_repo feeds/luci https://github.com/openwrt/luci "lede-17.01" _get_repo feeds/luci https://github.com/openwrt/luci "openwrt-18.06" diff --git a/root/package/firmware/brcmfmac-board-rpi/Makefile b/root/package/firmware/brcmfmac-board-rpi/Makefile new file mode 100644 index 00000000..4268d912 --- /dev/null +++ b/root/package/firmware/brcmfmac-board-rpi/Makefile @@ -0,0 +1,88 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=brcmfmac-board-rpi +PKG_VERSION:=2018-03-12 +PKG_RELEASE:=86e88fbf0345da49555d0ec34c80b4fbae7d0cd3 +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +BRCMFMAC434XX_SDIO_URL:=@GITHUB/RPi-Distro/firmware-nonfree/$(PKG_RELEASE)/brcm/ +BRCMFMAC43430_SDIO_FILE:=brcmfmac43430-sdio-$(PKG_RELEASE) +BRCMFMAC43455_SDIO_FILE:=brcmfmac43455-sdio-$(PKG_RELEASE) + +define Download/brcmfmac43430_sdio_txt + FILE:=$(BRCMFMAC43430_SDIO_FILE).txt + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43430-sdio.txt + HASH:=e4ce7ad5ce72406f958ed758539b65d958d1c0eb3e46e3f8e9f02b510d88e0b0 +endef +$(eval $(call Download,brcmfmac43430_sdio_txt)) + +define Download/brcmfmac43455_sdio_txt + FILE:=$(BRCMFMAC43455_SDIO_FILE).txt + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43455-sdio.txt + HASH:=15698c62457bcf25e60d063e6c666d6e1b7dacdf2b03e6d14ebbc619de6da6b7 +endef +$(eval $(call Download,brcmfmac43455_sdio_txt)) + +define Download/brcmfmac43455_sdio_clm_blob + FILE:=$(BRCMFMAC43455_SDIO_FILE).clm_blob + URL:=$(BRCMFMAC434XX_SDIO_URL) + URL_FILE:=brcmfmac43455-sdio.clm_blob + HASH:=8e2250518bc789e53109728c3c0a6124bc3801a75a1cb4966125753cf1f0252e +endef +$(eval $(call Download,brcmfmac43455_sdio_clm_blob)) + +define Package/brcmfmac-board-rpi/Default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://github.com/RPi-Distro/firmware-nonfree/ + DEPENDS:=@TARGET_brcm2708 + PKGARCH:=all +endef + +define Package/brcmfmac-board-rpi2 + $(call Package/brcmfmac-board-rpi/Default) + TITLE:=BCM43430 RPi SDIO NVRAM +endef + +define Package/brcmfmac-board-rpi2/description + NVRAM for the Broadcom BCM43430 on RPi boards. +endef + +define Package/brcmfmac-board-rpi3 + $(call Package/brcmfmac-board-rpi/Default) + TITLE:=BCM43455 RPi SDIO NVRAM +endef + +define Package/brcmfmac-board-rpi3/description + NVRAM and localisations blob for the Broadcom BCM43455 on RPi boards. +endef + +define Build/Prepare + rm -rf $(PKG_BUILD_DIR) + mkdir -p $(PKG_BUILD_DIR) + cp $(DL_DIR)/$(BRCMFMAC43430_SDIO_FILE).txt $(PKG_BUILD_DIR)/brcmfmac43430-sdio.txt + cp $(DL_DIR)/$(BRCMFMAC43455_SDIO_FILE).txt $(PKG_BUILD_DIR)/brcmfmac43455-sdio.txt + cp $(DL_DIR)/$(BRCMFMAC43455_SDIO_FILE).clm_blob $(PKG_BUILD_DIR)/brcmfmac43455-sdio.clm_blob +endef + +define Build/Compile + true +endef + +define Package/brcmfmac-board-rpi2/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43430-sdio.txt $(1)/lib/firmware/brcm/ +endef + +define Package/brcmfmac-board-rpi3/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43455-sdio.txt $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/brcmfmac43455-sdio.clm_blob $(1)/lib/firmware/brcm/ +endef + +$(eval $(call BuildPackage,brcmfmac-board-rpi2)) +$(eval $(call BuildPackage,brcmfmac-board-rpi3)) diff --git a/root/target/linux/brcm2708/Makefile b/root/target/linux/brcm2708/Makefile index f4a15810..6b1991bc 100644 --- a/root/target/linux/brcm2708/Makefile +++ b/root/target/linux/brcm2708/Makefile @@ -27,7 +27,6 @@ DEFAULT_PACKAGES += \ kmod-usb-hid \ kmod-sound-core kmod-sound-arm-bcm2835 \ kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \ - brcmfmac-firmware-43430-sdio brcmfmac-firmware-43455-sdio kmod-brcmfmac wpad-mini \ partx-utils mkf2fs e2fsprogs KERNELNAME:=Image dtbs diff --git a/root/target/linux/brcm2708/image/Makefile b/root/target/linux/brcm2708/image/Makefile new file mode 100644 index 00000000..aedea944 --- /dev/null +++ b/root/target/linux/brcm2708/image/Makefile @@ -0,0 +1,88 @@ +# +# Copyright (C) 2012-2015 OpenWrt.org +# Copyright (C) 2016-2017 LEDE project +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +FAT32_BLOCK_SIZE=1024 +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_BRCM2708_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) + +define Build/Compile + $(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux +endef + +### Image scripts ### +define Build/kernel-img + perl $(LINUX_DIR)/scripts/mkknlimg $@ $@.tmp + mv $@.tmp $@ +endef + +define Build/boot-img + rm -f $@.boot + mkfs.fat -C $@.boot $(FAT32_BLOCKS) + mcopy -i $@.boot $(KDIR)/COPYING.linux :: + mcopy -i $@.boot $(KDIR)/bootcode.bin :: + mcopy -i $@.boot $(KDIR)/LICENCE.broadcom :: + mcopy -i $@.boot $(KDIR)/start.elf :: + mcopy -i $@.boot $(KDIR)/start_cd.elf :: + mcopy -i $@.boot $(KDIR)/fixup.dat :: + mcopy -i $@.boot $(KDIR)/fixup_cd.dat :: + mcopy -i $@.boot cmdline.txt :: + mcopy -i $@.boot config.txt :: + mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG) + $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;) + mmd -i $@.boot ::/overlays + mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/ + mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/ +endef + +define Build/sdcard-img + ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \ + $(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE) +endef + +### Devices ### +define Device/Default + KERNEL := kernel-bin | kernel-img + KERNEL_IMG := kernel.img + IMAGES := factory.img.gz sysupgrade.img.gz + IMAGE/sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata + IMAGE/factory.img.gz := boot-img | sdcard-img | gzip +endef + +define Device/rpi + DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW + DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w + 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 + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 kmod-brcmfmac wpad-mini +endef +ifeq ($(SUBTARGET),bcm2708) + TARGET_DEVICES += rpi +endif + +define Device/rpi-2 + DEVICE_TITLE := Raspberry Pi 2B/3B/3B+/3CM + DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3 + 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 + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-firmware-43455-sdio brcmfmac-board-rpi2 brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini +endef +ifeq ($(SUBTARGET),bcm2709) + TARGET_DEVICES += rpi-2 +endif + +define Device/rpi-3 + KERNEL_IMG := kernel8.img + DEVICE_TITLE := Raspberry Pi 3B/3B+ + DEVICE_DTS := broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus + SUPPORTED_DEVICES := rpi-3-b rpi-3-b-plus raspberrypi,3-model-b raspberrypi,3-model-b-plus + DEVICE_PACKAGES := brcmfmac-firmware-43430-sdio brcmfmac-board-rpi2 brcmfmac-firmware-43455-sdio brcmfmac-board-rpi3 kmod-brcmfmac wpad-mini +endef +ifeq ($(SUBTARGET),bcm2710) + TARGET_DEVICES += rpi-3 +endif + +$(eval $(call BuildImage))