Permalink
Browse files

Added new firmware 7_45_77_0_hw (23/8/2017)

  • Loading branch information...
baselsayeh committed Dec 22, 2017
1 parent ec31cb5 commit 9acbd78dadb4ddad3627d8a14521202c9337c16b
View
@@ -32,6 +32,7 @@ bcm43430a1<sup>1</sup> | 7_45_41_46       | Raspberry Pi 3 and Zero W | R
bcm43451b1 | 7_63_43_0 | iPhone 6 | iOS 10.1.1 (14B100) | | | | X | X |
bcm43455 | 7_45_77_0_hw | Huawei P9 | Android 7 Stock | X | X | X | X | X |
bcm43455 | 7_120_5_1_sta_C0 | Galaxy J7 2017 | ? | | | | X | X |
bcm43455 |7_45_77_0_hw(8-2017)| Huawei P9 | Android 7 Stock | X | X | X | X | X |
bcm4356 | 7_35_101_5_sta | Nexus 6 | Android 7.1.2 | X | X | | X | X | O
bcm4358 | 7_112_200_17_sta | Nexus 6P | Android 7 Stock | X | X | | X | X | O
bcm4358 | 7_112_201_3_sta | Nexus 6P | Android 7.1.2 Stock | X | X | | X | X | O
View
@@ -5,6 +5,7 @@ Galaxy S4 (GT-I9505) | 6.30.171.1_sta | 0x14e4 | 0x43ae | 0x7206900
Nexus 5 | 6_37_34_43 | 0x14e4 | 0x43ae | 0x92069000 | 0x4339 | 0x1 | 0x2 | 0x2e | 0x6b6 | 0x14e4 | P106 | 0x625222b | 0x3570411 | 0x0 | 0xb | 0x6 | 0x0 | 0
iPhone 6 | 7.63.43.0 | 0x14e4 | 0x43ab | 0x44030b | 0x4345 | 0x5 | 0x0 | 0x33 | 0x70b | 0x14e4 | P307 | 0x73f2b00 | 0x249f4e30 | 0x0 | 0xb | 0xd | 0x0 | 0x7d80c
Huawei P9 | 7.45.77.0_hw | 0x14e4 | 0x43ab | 0x58030b | 0x4345 | 0x6 | 0x2 | 0x36 | 0x6e4 | 0x14e4 | P304 | 0x72d4d00 | 0x4130810 | 0x0 | 0xb | 0x14 | 0x0 | 0x79ac5
Huawei P9 |7_45_77_0_hw(8-2017)| 0x14e4 | 0x43ab | 0x58030b | 0x4345 | 0x6 | 0x2 | 0x36 | 0x6e4 | 0x14e4 | P304 | 0x72d4d00 | 0x4130810 | 0x0 | 0xb | 0x14 | 0x0 | 0x79ac5
Galaxy J7 2017 (SM-J730F) | 7.120.5.1_sta_c0 | 0x14e4 | 0x43ab | 0x58030b | 0x4345 | 0x6 | 0x2 | 0x36 | 0x6e4 | 0x14e4 | P304 | 0x77805 | 0x4134fbe | 0x0 | 0xb | 0x14 | ? | ?
Nexus 6 (XT1103) | 7.35.101.5 | 0x14e4 | 0x43ec | 0x292069 | 0x4356 | 0x2 | 0x2 | 0x30 | 0x732 | 0x14e4 | P101 | 0x7236505 | 0x3c3013c | 0x0 | 0xb | 0x11 | 0x0 | 0x5b2b4
Nexus 6P | 7_112_201_3_sta | 0x14e4 | 0x43e9 | 0x2e2069 | 0x4358 | 0x3 | 0x2 | 0x30 | 0x7a1 | 0x14e4 | P100 | 0x770c903 | 0x3c3013d | 0x0 | 0xb | 0x11 | 0x0 | 500210
@@ -0,0 +1,24 @@
include definitions.mk
all: ucode.bin templateram.bin flashpatches.c
ucode.bin: $(RAM_FILE) definitions.mk
@printf "\033[0;31m EXTRACTING UCODE\033[0m\n"
$(Q)dd if=$< of=$@ bs=1 skip=$$(($(UCODESTART)-$(RAMSTART))) count=$$(($(UCODESIZE))) 2>/dev/null
templateram.bin: $(RAM_FILE) definitions.mk
@printf "\033[0;31m EXTRACTING TEMPLATERAM\033[0m\n"
$(Q)dd if=$< of=$@ bs=1 skip=$$(($(TEMPLATERAMSTART)-$(RAMSTART))) count=$$(($(TEMPLATERAMSIZE))) 2>/dev/null
flashpatches.c: $(RAM_FILE) definitions.mk
@printf "\033[0;31m EXTRACTING FLASHPATCHES\033[0m\n"
$(Q)printf "#include <patcher.h>\n\n" > flashpatches.c
$(Q)$(NEXMON_ROOT)/buildtools/flash_patch_extractor/fpext -r $< -s $(RAMSTART) -b $(FP_CONFIG_ORIGBASE) -e $(FP_CONFIG_ORIGEND) >> $@
rom.bin: ../rom.bin
@printf "\033[0;31m APPLYING FLASHPATCHES TO CLEAN ROM\033[0m\n"
$(Q)$(NEXMON_ROOT)/buildtools/flash_patch_extractor/fpext -r $(RAM_FILE) -s $(RAMSTART) -b $(FP_CONFIG_ORIGBASE) -e $(FP_CONFIG_ORIGEND) -i $< -o $@ -t $(ROMSTART) > /dev/null
clean:
@printf "\033[0;31m CLEANING\033[0m\n"
$(Q)rm -f ucode.bin templateram.bin flashpatches.c rom.bin
@@ -0,0 +1,38 @@
NEXMON_CHIP=CHIP_VER_BCM43455
NEXMON_CHIP_NUM=`$(NEXMON_ROOT)/buildtools/scripts/getdefine.sh $(NEXMON_CHIP)`
NEXMON_FW_VERSION=FW_VER_7_45_77_0_23_8_2017
NEXMON_FW_VERSION_NUM=`$(NEXMON_ROOT)/buildtools/scripts/getdefine.sh $(NEXMON_FW_VERSION)`
NEXMON_ARCH=armv7-r
RAM_FILE=fw_bcm43455_hw.bin
RAMSTART=0x198000
RAMSIZE=0xC8000
ROM_FILE=rom.bin
ROMSTART=0x0
ROMSIZE=0xB0000
HNDRTE_RECLAIM_0_END=0x2290FC
PATCHSIZE=0x4000
PATCHSTART=$$(($(HNDRTE_RECLAIM_0_END) - $(PATCHSIZE)))
# original ucode start and size
UCODESTART=0x21B254
UCODESIZE=0xD5C8
# original template ram start and size
TEMPLATERAMSTART=0x22881C
TEMPLATERAMSIZE=0x8E0
FP_DATA_END_PTR=0x1FB2B0
FP_CONFIG_BASE_PTR_1=0x1FD304
FP_CONFIG_END_PTR_1=0x1FD300
FP_CONFIG_BASE_PTR_2=0x1FD588
FP_CONFIG_END_PTR_2=0x1FD584
FP_CONFIG_SIZE=0xc00
FP_CONFIG_BASE=$$(($(PATCHSTART) - $(FP_CONFIG_SIZE)))
FP_DATA_BASE=0x198800
FP_CONFIG_ORIGBASE=0x199000
FP_CONFIG_ORIGEND=0x199C00
Binary file not shown.
@@ -0,0 +1,52 @@
/***************************************************************************
* *
* ########### ########### ########## ########## *
* ############ ############ ############ ############ *
* ## ## ## ## ## ## ## *
* ## ## ## ## ## ## ## *
* ########### #### ###### ## ## ## ## ###### *
* ########### #### # ## ## ## ## # # *
* ## ## ###### ## ## ## ## # # *
* ## ## # ## ## ## ## # # *
* ############ ##### ###### ## ## ## ##### ###### *
* ########### ########### ## ## ## ########## *
* *
* S E C U R E M O B I L E N E T W O R K I N G *
* *
* This file is part of NexMon. *
* *
* Copyright (c) 2016 NexMon Team *
* *
* NexMon is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* NexMon is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with NexMon. If not, see <http://www.gnu.org/licenses/>. *
* *
**************************************************************************/
#ifndef STRUCTS_H
#define STRUCTS_H
/* band types */
#define WLC_BAND_AUTO 0 /* auto-select */
#define WLC_BAND_5G 1 /* 5 Ghz */
#define WLC_BAND_2G 2 /* 2.4 Ghz */
#define WLC_BAND_ALL 3 /* all bands */
#ifndef PAD
#define _PADLINE(line) pad ## line
#define _XSTR(line) _PADLINE(line)
#define PAD _XSTR(__LINE__)
#endif
#include "../structs.common.h"
#endif /*STRUCTS_H */
@@ -0,0 +1,198 @@
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
include ../version.mk
include $(FW_PATH)/definitions.mk
LOCAL_SRCS=$(wildcard src/*.c) src/ucode_compressed.c src/templateram.c
COMMON_SRCS=$(wildcard $(NEXMON_ROOT)/patches/common/*.c)
FW_SRCS=$(wildcard $(FW_PATH)/*.c)
OBJS=$(addprefix obj/,$(notdir $(LOCAL_SRCS:.c=.o)) $(notdir $(COMMON_SRCS:.c=.o)) $(notdir $(FW_SRCS:.c=.o)))
CFLAGS= \
-fplugin=$(CCPLUGIN) \
-fplugin-arg-nexmon-objfile=$@ \
-fplugin-arg-nexmon-prefile=gen/nexmon.pre \
-fplugin-arg-nexmon-chipver=$(NEXMON_CHIP_NUM) \
-fplugin-arg-nexmon-fwver=$(NEXMON_FW_VERSION_NUM) \
-fno-strict-aliasing \
-DNEXMON_CHIP=$(NEXMON_CHIP) \
-DNEXMON_FW_VERSION=$(NEXMON_FW_VERSION) \
-DPATCHSTART=$(PATCHSTART) \
-DUCODESIZE=$(UCODESIZE) \
-DGIT_VERSION=\"$(GIT_VERSION)\" \
-DBUILD_NUMBER=\"$$(cat BUILD_NUMBER)\" \
-Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -march=$(NEXMON_ARCH) \
-ffunction-sections -fdata-sections \
-I$(NEXMON_ROOT)/patches/include \
-Iinclude \
-I$(FW_PATH)
all: fw_bcm43455_hw.bin
init: FORCE
$(Q)if ! test -f BUILD_NUMBER; then echo 0 > BUILD_NUMBER; fi
$(Q)echo $$(($$(cat BUILD_NUMBER) + 1)) > BUILD_NUMBER
$(Q)touch src/version.c
$(Q)make -s -f $(NEXMON_ROOT)/patches/common/header.mk
$(Q)mkdir -p obj gen log
obj/%.o: src/%.c
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
obj/%.o: $(NEXMON_ROOT)/patches/common/%.c
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
obj/%.o: $(FW_PATH)/%.c
@printf "\033[0;31m COMPILING\033[0m %s => %s (details: log/compiler.log)\n" $< $@
$(Q)cat gen/nexmon.pre 2>>log/error.log | gawk '{ if ($$3 != "$@") print; }' > tmp && mv tmp gen/nexmon.pre
$(Q)$(CC)gcc $(CFLAGS) -c $< -o $@ >>log/compiler.log
gen/nexmon2.pre: $(OBJS)
@printf "\033[0;31m PREPARING\033[0m %s => %s\n" "gen/nexmon.pre" $@
$(Q)cat gen/nexmon.pre | awk '{ if ($$3 != "obj/flashpatches.o" && $$3 != "obj/wrapper.o") { print $$0; } }' > tmp
$(Q)cat gen/nexmon.pre | awk '{ if ($$3 == "obj/flashpatches.o" || $$3 == "obj/wrapper.o") { print $$0; } }' >> tmp
$(Q)cat tmp | awk '{ if ($$1 ~ /^0x/) { if ($$3 != "obj/flashpatches.o" && $$3 != "obj/wrapper.o") { if (!x[$$1]++) { print $$0; } } else { if (!x[$$1]) { print $$0; } } } else { print $$0; } }' > gen/nexmon2.pre
gen/nexmon.ld: gen/nexmon2.pre $(OBJS)
@printf "\033[0;31m GENERATING LINKER FILE\033[0m gen/nexmon.pre => %s\n" $@
$(Q)sort gen/nexmon2.pre | gawk -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.ld.awk > $@
gen/nexmon.mk: gen/nexmon2.pre $(OBJS) $(FW_PATH)/definitions.mk
@printf "\033[0;31m GENERATING MAKE FILE\033[0m gen/nexmon.pre => %s\n" $@
$(Q)printf "fw_bcm43455_hw.bin: gen/patch.elf FORCE\n" > $@
$(Q)sort gen/nexmon2.pre | \
gawk -v src_file=gen/patch.elf -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.mk.1.awk | \
gawk -v ramstart=$(RAMSTART) -f $(NEXMON_ROOT)/buildtools/scripts/nexmon.mk.2.awk >> $@
$(Q)printf "\nFORCE:\n" >> $@
$(Q)gawk '!a[$$0]++' $@ > tmp && mv tmp $@
gen/flashpatches.ld: gen/nexmon2.pre $(OBJS)
@printf "\033[0;31m GENERATING LINKER FILE\033[0m gen/nexmon.pre => %s\n" $@
$(Q)sort gen/nexmon2.pre | \
gawk -f $(NEXMON_ROOT)/buildtools/scripts/flashpatches.ld.awk > $@
gen/flashpatches.mk: gen/nexmon2.pre $(OBJS) $(FW_PATH)/definitions.mk
@printf "\033[0;31m GENERATING MAKE FILE\033[0m gen/nexmon.pre => %s\n" $@
$(Q)cat gen/nexmon2.pre | gawk \
-v fp_data_base=$(FP_DATA_BASE) \
-v fp_config_base=$(FP_CONFIG_BASE) \
-v fp_data_end_ptr=$(FP_DATA_END_PTR) \
-v fp_config_base_ptr_1=$(FP_CONFIG_BASE_PTR_1) \
-v fp_config_end_ptr_1=$(FP_CONFIG_END_PTR_1) \
-v fp_config_base_ptr_2=$(FP_CONFIG_BASE_PTR_2) \
-v fp_config_end_ptr_2=$(FP_CONFIG_END_PTR_2) \
-v ramstart=$(RAMSTART) \
-v out_file=fw_bcm43455_hw.bin \
-v src_file=gen/patch.elf \
-f $(NEXMON_ROOT)/buildtools/scripts/flashpatches.mk.awk > $@
gen/memory.ld: $(FW_PATH)/definitions.mk
@printf "\033[0;31m GENERATING LINKER FILE\033[0m %s\n" $@
$(Q)printf "rom : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(ROMSTART) $(ROMSIZE) > $@
$(Q)printf "ram : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(RAMSTART) $(RAMSIZE) >> $@
$(Q)printf "patch : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(PATCHSTART) $(PATCHSIZE) >> $@
$(Q)printf "ucode : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(UCODESTART) $$(($(FP_CONFIG_BASE) - $(UCODESTART))) >> $@
$(Q)printf "fpconfig : ORIGIN = 0x%08x, LENGTH = 0x%08x\n" $(FP_CONFIG_BASE) $(FP_CONFIG_SIZE) >> $@
gen/patch.elf: patch.ld gen/nexmon.ld gen/flashpatches.ld gen/memory.ld $(OBJS)
@printf "\033[0;31m LINKING OBJECTS\033[0m => %s (details: log/linker.log, log/linker.err)\n" $@
$(Q)$(CC)ld -T $< -o $@ --gc-sections --print-gc-sections -M >>log/linker.log 2>>log/linker.err
fw_bcm43455_hw.bin: init gen/patch.elf $(FW_PATH)/$(RAM_FILE) gen/nexmon.mk gen/flashpatches.mk
$(Q)cp $(FW_PATH)/$(RAM_FILE) $@
@printf "\033[0;31m APPLYING FLASHPATCHES\033[0m gen/flashpatches.mk => %s (details: log/flashpatches.log)\n" $@
$(Q)make -f gen/flashpatches.mk >>log/flashpatches.log 2>>log/flashpatches.log
@printf "\033[0;31m APPLYING PATCHES\033[0m gen/nexmon.mk => %s (details: log/patches.log)\n" $@
$(Q)make -f gen/nexmon.mk >>log/patches.log 2>>log/flashpatches.log
fw_bcm43455_hw.complete.clean.bin: $(FW_PATH)/$(RAM_FILE) $(FW_PATH)/$(ROM_FILE)
dd if=$(FW_PATH)/$(ROM_FILE) of=$@ bs=1 status=none conv=notrunc seek=$$(($(ROMSTART)))
dd if=$< of=$@ bs=1 status=none conv=notrunc seek=$$(($(RAMSTART)))
fw_bcm43455_hw.complete.bin: fw_bcm43455_hw.bin $(FW_PATH)/$(ROM_FILE)
dd if=$(FW_PATH)/$(ROM_FILE) of=$@ bs=1 status=none conv=notrunc seek=$$(($(ROMSTART)))
dd if=$< of=$@ bs=1 status=none conv=notrunc seek=$$(($(RAMSTART)))
###################################################################
# ucode compression related
###################################################################
ifneq ($(wildcard src/ucode.asm), )
gen/ucode.bin: src/ucode.asm
@printf "\033[0;31m ASSEMBLING UCODE\033[0m %s => %s\n" $< $@
ifneq ($(wildcard $(NEXMON_ROOT)/buildtools/b43/assembler/b43-asm.bin), )
$(Q)PATH=$(PATH):$(NEXMON_ROOT)/buildtools/b43/assembler $(NEXMON_ROOT)/buildtools/b43/assembler/b43-asm $< $@ --format raw-le32
else
$(error Warning: please compile b43-asm.bin first)
endif
else
gen/ucode.bin: $(FW_PATH)/ucode.bin
@printf "\033[0;31m COPYING UCODE\033[0m %s => %s\n" $< $@
$(Q)cp $< $@
endif
gen/ucode_compressed.bin: gen/ucode.bin
@printf "\033[0;31m COMPRESSING UCODE\033[0m %s => %s\n" $< $@
$(Q)cat $< | $(ZLIBFLATE) > $@
src/ucode_compressed.c: gen/ucode_compressed.bin
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
src/templateram.c: $(FW_PATH)/templateram.bin
@printf "\033[0;31m GENERATING C FILE\033[0m %s => %s\n" $< $@
$(Q)printf "#pragma NEXMON targetregion \"ucode\"\n\n" > $@
$(Q)cd $(dir $<) && xxd -i $(notdir $<) >> $(shell pwd)/$@
###################################################################
check-nexmon-setup-env:
ifndef NEXMON_SETUP_ENV
$(error run 'source setup_env.sh' first in the repository\'s root directory)
endif
install-firmware: fw_bcm43455_hw.bin
@printf "\033[0;31m REMOUNTING /vendor\033[0m\n"
$(Q)adb shell 'su -c "mount -o rw,remount /vendor"'
@printf "\033[0;31m COPYING TO PHONE\033[0m %s => /sdcard/%s\n" $< $<
$(Q)adb push $< /sdcard/ >> log/adb.log 2>> log/adb.log
@printf "\033[0;31m COPYING\033[0m /sdcard/fw_bcm43455_hw.bin => /vendor/firmware/fw_bcm43455_hw.bin\n"
$(Q)adb shell 'su -c "cp /sdcard/fw_bcm43455_hw.bin /vendor/firmware/fw_bcm43455_hw.bin"'
@printf "\033[0;31m RELOADING FIRMWARE\033[0m\n"
$(Q)adb shell 'su -c "ifconfig wlan0 down && ifconfig wlan0 up"'
install-original: $(FW_PATH)/$(RAM_FILE)
@printf "\033[0;31m REMOUNTING /vendor\033[0m\n"
$(Q)adb shell 'su -c "mount -o rw,remount /vendor"'
@printf "\033[0;31m COPYING TO PHONE\033[0m %s => /sdcard/%s\n" $< $<
$(Q)adb push $< /sdcard/ >> log/adb.log 2>> log/adb.log
@printf "\033[0;31m COPYING\033[0m /sdcard/fw_bcm43455_hw.bin => /vendor/firmware/fw_bcm43455_hw.bin\n"
$(Q)adb shell 'su -c "cp /sdcard/fw_bcm43455_hw.bin /vendor/firmware/fw_bcm43455_hw.bin"'
@printf "\033[0;31m RELOADING FIRMWARE\033[0m\n"
$(Q)adb shell 'su -c "ifconfig wlan0 down && ifconfig wlan0 up"'
backup-firmware: FORCE
adb shell 'su -c "cp /vendor/firmware/fw_bcm43455_hw.bin /sdcard/fw_bcm43455_hw.orig.bin"'
adb pull /sdcard/fw_bcm43455_hw.orig.bin
install-backup: fw_bcm43455_hw.orig.bin
adb shell 'su -c "mount -o rw,remount /system"' && \
adb push $< /sdcard/ && \
adb shell 'su -c "cp /sdcard/fw_bcm43455_hw.bin /vendor/firmware/fw_bcm43455_hw.bin"'
adb shell 'su -c "ifconfig wlan0 down && ifconfig wlan0 up"'
clean-firmware: FORCE
@printf "\033[0;31m CLEANING\033[0m\n"
$(Q)rm -fr fw_bcm43455_hw.bin obj gen log src/ucode_compressed.c src/templateram.c
clean: clean-firmware
$(Q)rm -f BUILD_NUMBER
FORCE:
Oops, something went wrong.

0 comments on commit 9acbd78

Please sign in to comment.