Skip to content

Commit fd117f4

Browse files
committed
bcm4375: added firmware patch for version 18.41.117
1 parent 7cf4297 commit fd117f4

File tree

12 files changed

+1776
-0
lines changed

12 files changed

+1776
-0
lines changed
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
2+
SHELL := /bin/bash
3+
include ../version.mk
4+
include $(FW_PATH)/definitions.mk
5+
6+
LOCAL_SRCS=$(wildcard src/*.c) src/ucode1_compressed.c src/ucode2_compressed.c src/templateram0.c src/templateram1.c src/templateram2.c
7+
COMMON_SRCS=$(wildcard $(NEXMON_ROOT)/patches/common/*.c)
8+
FW_SRCS=$(wildcard $(FW_PATH)/*.c)
9+
10+
OBJS=$(addprefix obj/,$(notdir $(LOCAL_SRCS:.c=.o)) $(notdir $(COMMON_SRCS:.c=.o)) $(notdir $(FW_SRCS:.c=.o)))
11+
12+
CFLAGS= \
13+
-fplugin=$(CCPLUGIN) \
14+
-fplugin-arg-nexmon-objfile=$@ \
15+
-fplugin-arg-nexmon-prefile=gen/nexmon.pre \
16+
-fplugin-arg-nexmon-chipver=$(NEXMON_CHIP_NUM) \
17+
-fplugin-arg-nexmon-fwver=$(NEXMON_FW_VERSION_NUM) \
18+
-fno-strict-aliasing \
19+
-DNEXMON_CHIP=$(NEXMON_CHIP) \
20+
-DNEXMON_FW_VERSION=$(NEXMON_FW_VERSION) \
21+
-DWLC_UCODE_WRITE_BL_HOOK_ADDR=$(WLC_UCODE_WRITE_BL_HOOK_ADDR) \
22+
-DUCODE1START_PTR=$(UCODE1START_PTR) \
23+
-DUCODE1SIZE_PTR=$(UCODE1SIZE_PTR) \
24+
-DUCODE2START_PTR=$(UCODE2START_PTR) \
25+
-DUCODE2SIZE_PTR=$(UCODE2SIZE_PTR) \
26+
-DHNDRTE_RECLAIM_0_END_PTR=$(HNDRTE_RECLAIM_0_END_PTR) \
27+
-DTEMPLATERAMSTART0_PTR=$(TEMPLATERAMSTART0_PTR) \
28+
-DTEMPLATERAMSTART1_PTR=$(TEMPLATERAMSTART1_PTR) \
29+
-DTEMPLATERAMSTART2_PTR=$(TEMPLATERAMSTART2_PTR) \
30+
-DVASIPSTART_PTR=$(VASIPSTART_PTR) \
31+
-DFP_CONFIG_ORIGBASE=$(FP_CONFIG_ORIGBASE) \
32+
-DFP_CONFIG_ORIGEND=$(FP_CONFIG_ORIGEND) \
33+
-DPATCHSTART=$(PATCHSTART) \
34+
-DUCODESIZE=$(UCODESIZE) \
35+
-DGIT_VERSION=\"$(GIT_VERSION)\" \
36+
-DBUILD_NUMBER=\"$$(cat BUILD_NUMBER)\" \
37+
-Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -march=$(NEXMON_ARCH) \
38+
-ffunction-sections -fdata-sections \
39+
-I$(NEXMON_ROOT)/patches/include \
40+
-Iinclude \
41+
-I$(FW_PATH)
42+
43+
all: $(RAM_FILE)
44+
45+
init: FORCE
46+
$(Q)if ! test -f BUILD_NUMBER; then echo 0 > BUILD_NUMBER; fi
47+
$(Q)echo $$(($$(cat BUILD_NUMBER) + 1)) > BUILD_NUMBER
48+
$(Q)touch src/version.c
49+
$(Q)make -s -f $(NEXMON_ROOT)/patches/common/header.mk
50+
$(Q)mkdir -p obj gen log
51+
52+
obj/%.o: src/%.c
53+
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
54+
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
55+
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
56+
57+
obj/%.o: $(NEXMON_ROOT)/patches/common/%.c
58+
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
59+
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
60+
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
61+
62+
obj/%.o: $(FW_PATH)/%.c
63+
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
64+
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
65+
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
66+
67+
gen/nexmon2.pre: $(OBJS)
68+
@printf "\033[0;31m PREPARING\033[0m %s => %s\n" "gen/nexmon.pre" $@
69+
$(Q)cat gen/nexmon.pre | awk '{ if ($$3 != "obj/flashpatches.o" && $$3 != "obj/wrapper.o" && $$3 != "obj/local_wrapper.o") { print $$0; } }' > tmp
70+
$(Q)cat gen/nexmon.pre | awk '{ if ($$3 == "obj/flashpatches.o" || $$3 == "obj/wrapper.o" || $$3 == "obj/local_wrapper.o") { print $$0; } }' >> tmp
71+
$(Q)cat tmp | awk '{ if ($$1 ~ /^0x/) { if ($$3 != "obj/flashpatches.o" && $$3 != "obj/wrapper.o" && $$3 != "obj/local_wrapper.o") { if (!x[$$1]++) { print $$0; } } else { if (!x[$$1]) { print $$0; } } } else { print $$0; } }' > gen/nexmon2.pre
72+
73+
gen/nexmon.ld: gen/nexmon2.pre $(OBJS)
74+
@printf "\033[0;31m GENERATING LINKER FILE\033[0m gen/nexmon.pre => %s\n" $@
75+
$(Q)sort gen/nexmon2.pre | gawk -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.ld.awk > $@
76+
77+
gen/nexmon.mk: gen/nexmon2.pre $(OBJS) $(FW_PATH)/definitions.mk
78+
@printf "\033[0;31m GENERATING MAKE FILE\033[0m gen/nexmon.pre => %s\n" $@
79+
$(Q)printf "$(RAM_FILE): gen/patch.elf FORCE\n" > $@
80+
$(Q)sort gen/nexmon2.pre | \
81+
gawk -v src_file=gen/patch.elf -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.mk.1.awk | \
82+
gawk -v ramstart=$(RAMSTART) -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.mk.2.awk >> $@
83+
$(Q)printf "\nFORCE:\n" >> $@
84+
$(Q)gawk '!a[$$0]++' $@ > tmp && mv tmp $@
85+
86+
gen/flashpatches.ld: gen/nexmon2.pre $(OBJS)
87+
@printf "\033[0;31m GENERATING LINKER FILE\033[0m gen/nexmon.pre => %s\n" $@
88+
$(Q)sort gen/nexmon2.pre | \
89+
gawk -f $(NEXMON_ROOT)/buildtools/scripts/flashpatches.ld.awk > $@
90+
91+
gen/flashpatches.mk: gen/nexmon2.pre $(OBJS) $(FW_PATH)/definitions.mk
92+
@printf "\033[0;31m GENERATING MAKE FILE\033[0m gen/nexmon.pre => %s\n" $@
93+
$(Q)cat gen/nexmon2.pre | gawk \
94+
-v fp_data_base=$(FP_DATA_BASE) \
95+
-v fp_config_base=$(FP_CONFIG_BASE) \
96+
-v fp_config_base_ptr_1=$(FP_CONFIG_BASE_PTR_1) \
97+
-v fp_config_end_ptr_1=$(FP_CONFIG_END_PTR_1) \
98+
-v fp_config_base_ptr_2=$(FP_CONFIG_BASE_PTR_2) \
99+
-v fp_config_end_ptr_2=$(FP_CONFIG_END_PTR_2) \
100+
-v ramstart=$(RAMSTART) \
101+
-v out_file=$(RAM_FILE) \
102+
-v src_file=gen/patch.elf \
103+
-f $(NEXMON_ROOT)/buildtools/scripts/flashpatches.bcm4375.mk.awk > $@
104+
105+
gen/memory.ld: $(FW_PATH)/definitions.mk
106+
@printf "\033[0;31m GENERATING LINKER FILE\033[0m %s\n" $@
107+
$(Q)printf "rom : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(ROMSTART) $(ROMSIZE) > $@
108+
$(Q)printf "ram : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(RAMSTART) $(RAMSIZE) >> $@
109+
$(Q)printf "patch : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(PATCHSTART) $(PATCHSIZE) >> $@
110+
$(Q)printf "ucode : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(UCODE1START) $$(($(FP_CONFIG_BASE) - $(UCODE1START))) >> $@
111+
$(Q)printf "fpconfig : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(FP_CONFIG_BASE) $(FP_CONFIG_SIZE) >> $@
112+
113+
gen/patch.elf: patch.ld gen/nexmon.ld gen/flashpatches.ld gen/memory.ld $(OBJS)
114+
@printf "\033[0;31m LINKING OBJECTS\033[0m => %s (details: log/linker.log, log/linker.err)\n" $@
115+
$(Q)$(CC)ld -T $< -o $@ --gc-sections --print-gc-sections -M >>log/linker.log 2>>log/linker.err
116+
117+
$(RAM_FILE): init gen/patch.elf $(FW_PATH)/$(RAM_FILE) gen/nexmon.mk gen/flashpatches.mk
118+
$(Q)cp $(FW_PATH)/$(RAM_FILE) $@
119+
@printf "\033[0;31m APPLYING FLASHPATCHES\033[0m gen/flashpatches.mk => %s (details: log/flashpatches.log)\n" $@
120+
$(Q)make -f gen/flashpatches.mk >>log/flashpatches.log 2>>log/flashpatches.log
121+
@printf "\033[0;31m APPLYING PATCHES\033[0m gen/nexmon.mk => %s (details: log/patches.log)\n" $@
122+
$(Q)make -f gen/nexmon.mk >>log/patches.log 2>>log/flashpatches.log
123+
124+
fw_bcmdhd.complete.clean.bin: $(FW_PATH)/$(RAM_FILE) $(FW_PATH)/$(ROM_FILE)
125+
dd if=$(FW_PATH)/$(ROM_FILE) of=$@ bs=1 status=none conv=notrunc seek=$$(($(ROMSTART)))
126+
dd if=$< of=$@ bs=1 status=none conv=notrunc seek=$$(($(RAMSTART)))
127+
128+
fw_bcmdhd.complete.bin: $(RAM_FILE) $(FW_PATH)/$(ROM_FILE)
129+
dd if=$(FW_PATH)/$(ROM_FILE) of=$@ bs=1 status=none conv=notrunc seek=$$(($(ROMSTART)))
130+
dd if=$< of=$@ bs=1 status=none conv=notrunc seek=$$(($(RAMSTART)))
131+
132+
###################################################################
133+
# ucode compression related
134+
###################################################################
135+
136+
gen/ucode1.bin: $(FW_PATH)/ucode1.bin
137+
@printf "\033[0;31m COPYING UCODE1\033[0m %s => %s\n" $< $@
138+
$(Q)cp $< $@
139+
140+
gen/ucode2.bin: $(FW_PATH)/ucode2.bin
141+
@printf "\033[0;31m COPYING UCODE2\033[0m %s => %s\n" $< $@
142+
$(Q)cp $< $@
143+
144+
gen/ucode1_compressed.bin: gen/ucode1.bin
145+
@printf "\033[0;31m COMPRESSING UCODE1\033[0m %s => %s\n" $< $@
146+
$(Q)cat $< | $(ZLIBFLATE) > $@
147+
148+
gen/ucode2_compressed.bin: gen/ucode2.bin
149+
@printf "\033[0;31m COMPRESSING UCODE2\033[0m %s => %s\n" $< $@
150+
$(Q)cat $< | $(ZLIBFLATE) > $@
151+
152+
src/ucode1_compressed.c: gen/ucode1_compressed.bin
153+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
154+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
155+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
156+
157+
src/ucode2_compressed.c: gen/ucode2_compressed.bin
158+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
159+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
160+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
161+
162+
163+
src/templateram0.c: $(FW_PATH)/templateram0.bin
164+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
165+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
166+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
167+
168+
src/templateram1.c: $(FW_PATH)/templateram1.bin
169+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
170+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
171+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
172+
173+
src/templateram2.c: $(FW_PATH)/templateram2.bin
174+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
175+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
176+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
177+
178+
src/vasip.c: $(FW_PATH)/vasip.bin
179+
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
180+
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
181+
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
182+
183+
###################################################################
184+
185+
check-nexmon-setup-env:
186+
ifndef NEXMON_SETUP_ENV
187+
$(error run 'source setup_env.sh' first in the repository\'s root directory)
188+
endif
189+
190+
dump-rom: FORCE
191+
@printf "\033[0;31m DUMPING ROM TO\033[0m /var/root/romdump.bin\n"
192+
adb shell "su -c 'nexutil -g0x602 -l1024 -i -v0x0 -r'" > rom.bin && for n in {1..1343}; do adb shell "su -c 'nexutil -g0x602 -l1024 -i -v$$(($$n*1024)) -r'" >> rom.bin; done
193+
194+
install-firmware: $(RAM_FILE)
195+
@printf "\033[0;31m REMOUNTING /system\033[0m\n"
196+
$(Q)adb shell 'su -c "mount -o rw,remount /system"'
197+
@printf "\033[0;31m COPYING TO PHONE\033[0m %s => /sdcard/%s\n" $< $<
198+
$(Q)adb push $< /sdcard/ >> log/adb.log 2>> log/adb.log
199+
@printf "\033[0;31m COPYING\033[0m /sdcard/$(RAM_FILE) => /vendor/etc/wifi/$(RAM_FILE)\n"
200+
$(Q)adb shell 'su -c "cp /sdcard/$(RAM_FILE) /vendor/etc/wifi/$(RAM_FILE)"'
201+
@printf "\033[0;31m RELOADING FIRMWARE\033[0m\n"
202+
$(Q)adb shell 'su -c "ifconfig wlan0 down && ifconfig wlan0 up"'
203+
204+
install-remote: $(RAM_FILE)
205+
scp $(RAM_FILE) s20:~
206+
ssh s20 "cp bcmdhd_sta.bin_b1 /data/tmpfs/"
207+
# ssh s20 "unchroot /data/tmpfs/install"
208+
209+
clean-firmware: FORCE
210+
@printf "\033[0;31m CLEANING\033[0m\n"
211+
$(Q)rm -fr $(RAM_FILE) obj gen log src/ucode1_compressed.c src/ucode2_compressed.c src/templateram0.c src/templateram1.c src/templateram2.c src/vasip.c
212+
213+
clean: clean-firmware
214+
$(Q)rm -f BUILD_NUMBER
215+
216+
FORCE:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/***************************************************************************
2+
* *
3+
* ########### ########### ########## ########## *
4+
* ############ ############ ############ ############ *
5+
* ## ## ## ## ## ## ## *
6+
* ## ## ## ## ## ## ## *
7+
* ########### #### ###### ## ## ## ## ###### *
8+
* ########### #### # ## ## ## ## # # *
9+
* ## ## ###### ## ## ## ## # # *
10+
* ## ## # ## ## ## ## # # *
11+
* ############ ##### ###### ## ## ## ##### ###### *
12+
* ########### ########### ## ## ## ########## *
13+
* *
14+
* S E C U R E M O B I L E N E T W O R K I N G *
15+
* *
16+
* This file is part of NexMon. *
17+
* *
18+
* Copyright (c) 2016 NexMon Team *
19+
* *
20+
* NexMon is free software: you can redistribute it and/or modify *
21+
* it under the terms of the GNU General Public License as published by *
22+
* the Free Software Foundation, either version 3 of the License, or *
23+
* (at your option) any later version. *
24+
* *
25+
* NexMon is distributed in the hope that it will be useful, *
26+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
27+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28+
* GNU General Public License for more details. *
29+
* *
30+
* You should have received a copy of the GNU General Public License *
31+
* along with NexMon. If not, see <http://www.gnu.org/licenses/>. *
32+
* *
33+
**************************************************************************/
34+
35+
#ifndef LOCAL_WRAPPER_H
36+
#define LOCAL_WRAPPER_H
37+
38+
#include "../src/local_wrapper.c" // wrapper definitions for functions that already exist in the firmware
39+
40+
#endif /*LOCAL_WRAPPER_H*/
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/***************************************************************************
2+
* *
3+
* ########### ########### ########## ########## *
4+
* ############ ############ ############ ############ *
5+
* ## ## ## ## ## ## ## *
6+
* ## ## ## ## ## ## ## *
7+
* ########### #### ###### ## ## ## ## ###### *
8+
* ########### #### # ## ## ## ## # # *
9+
* ## ## ###### ## ## ## ## # # *
10+
* ## ## # ## ## ## ## # # *
11+
* ############ ##### ###### ## ## ## ##### ###### *
12+
* ########### ########### ## ## ## ########## *
13+
* *
14+
* S E C U R E M O B I L E N E T W O R K I N G *
15+
* *
16+
* This file is part of NexMon. *
17+
* *
18+
* Copyright (c) 2016 NexMon Team *
19+
* *
20+
* NexMon is free software: you can redistribute it and/or modify *
21+
* it under the terms of the GNU General Public License as published by *
22+
* the Free Software Foundation, either version 3 of the License, or *
23+
* (at your option) any later version. *
24+
* *
25+
* NexMon is distributed in the hope that it will be useful, *
26+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
27+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28+
* GNU General Public License for more details. *
29+
* *
30+
* You should have received a copy of the GNU General Public License *
31+
* along with NexMon. If not, see <http://www.gnu.org/licenses/>. *
32+
* *
33+
**************************************************************************/
34+
35+
#ifndef VENDOR_RADIOTAP_H
36+
#define VENDOR_RADIOTAP_H
37+
38+
extern const struct ieee80211_radiotap_vendor_namespaces rtap_vendor_namespaces;
39+
40+
/* Name Data type Units
41+
* ---- --------- -----
42+
*
43+
* RADIOTAP_NEX_TXDELAY s32 milliseconds
44+
*
45+
* Value in milliseconds to wait before transmitting this frame
46+
* for the first time
47+
*
48+
* RADIOTAP_NEX_TXREPETITIONS 2 x s32 unitless, milliseconds
49+
*
50+
* Amount of how often this frame should be transmitted and the
51+
* periodicity in milliseconds of the retransmissions. Setting
52+
* the number of retransmissions to -1 leads to infinite
53+
* retransmissions
54+
*
55+
* RADIOTAP_NEX_RATESPEC u32 unitless
56+
*
57+
* Define the ratespec according to the definitions in rates.h
58+
* This value overrides the rate settings in the regular
59+
* radiotap header
60+
*/
61+
enum radiotap_nex_vendor_subns_0_type {
62+
RADIOTAP_NEX_TXDELAY = 0,
63+
RADIOTAP_NEX_TXREPETITIONS = 1,
64+
RADIOTAP_NEX_RATESPEC = 2
65+
};
66+
67+
#endif /* VENDOR_RADIOTAP_H */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
MEMORY
2+
{
3+
INCLUDE gen/memory.ld
4+
}
5+
6+
SECTIONS
7+
{
8+
INCLUDE gen/flashpatches.ld
9+
INCLUDE gen/nexmon.ld
10+
}

0 commit comments

Comments
 (0)