aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/image
diff options
context:
space:
mode:
authorMikhail Zhilkin <csharper2005@gmail.com>2022-03-18 18:09:45 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2022-07-03 20:25:38 +0200
commitbd783fd60a5f9513aa405437efff55fe29cd89c2 (patch)
tree280d2a7d6fb7b0a15ff6985dac23d1a279294ed2 /target/linux/ramips/image
parent0cb1dc02771ce1c4cad20017a6d5616718db3877 (diff)
downloadupstream-bd783fd60a5f9513aa405437efff55fe29cd89c2.tar.gz
upstream-bd783fd60a5f9513aa405437efff55fe29cd89c2.tar.bz2
upstream-bd783fd60a5f9513aa405437efff55fe29cd89c2.zip
ramips: add support for Beeline SmartBox GIGA
Beeline SmartBox GIGA is a wireless WiFi 5 router manufactured by Sercomm company. Device specification -------------------- SoC Type: MediaTek MT7621AT RAM: 256 MiB, Nanya NT5CC128M16JR-EK Flash: 128 MiB, Macronix MX30LF1G18AC Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2 Wireless 5 GHz (MT7613BE): a/n/ac, 2x2 Ethernet: 3 ports - 2xGbE (WAN, LAN1), 1xFE (LAN2) USB ports: 1xUSB3.0 Button: 1 button (Reset/WPS) PCB ID: DBE00B-1.6MM LEDs: 1 RGB LED Power: 12 VDC, 1.5 A Connector type: barrel Bootloader: U-Boot Installation ----------------- 1. Downgrade stock (Beeline) firmware to v.1.0.02; 2. Give factory OpenWrt image a shorter name, e.g. 1001.img; 3. Upload and update the firmware via the original web interface. Remark: You might need make the 3rd step twice if your running firmware is booted from the Slot 1 (Sercomm0 bootflag). The stock firmware reverses the bootflag (Sercomm0 / Sercomm1) on each firmware update. Revert to stock --------------- 1. Change the bootflag to Sercomm1 in OpenWrt CLI and then reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 2. Optional: Update with any stock (Beeline) firmware if you want to overwrite OpenWrt in Slot 0 completely. MAC Addresses ------------- +-----+-----------+---------+ | use | address | example | +-----+-----------+---------+ | LAN | label | *:16 | | WAN | label + 1 | *:17 | | 2g | label + 4 | *:1a | | 5g | label + 5 | *:1b | +-----+-----------+---------+ The label MAC address was found in Factory 0x21000 Notes ----- 1. The following scripts are required for the build: sercomm-crypto.py - already exists in OpenWrt sercomm-partition-tag.py - already exists in OpenWrt sercomm-payload.py - already exists in OpenWrt sercomm-pid.py - new, the part of this pull request sercomm-kernel-header.py - new, the part of this pull request 2. This device (same as other Sercomm S2,S3-based devices) requires special LZMA and LOADADDR settings for successful boot: LZMA_TEXT_START=0x82800000 KERNEL_LOADADDR=0x81001000 LOADADDR=0x80001000 3. This device (same as several other Sercomm-based devices - Beeline, Netgear, Etisalat, Rostelecom) has partition map (mtd1) containing real partition offsets, which may differ from device to device depending on the number and location of bad blocks on NAND. "fixed-partitions" is used if the partition map is not found or corrupted. This behavour (it's the same as on stock firmware) is provided by MTD_SERCOMM_PARTS module. Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Diffstat (limited to 'target/linux/ramips/image')
-rw-r--r--target/linux/ramips/image/Makefile7
-rw-r--r--target/linux/ramips/image/common-sercomm.mk87
-rw-r--r--target/linux/ramips/image/mt7621.mk14
3 files changed, 106 insertions, 2 deletions
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index f481e6e447..d48b220231 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
-DEVICE_VARS += LOADER_TYPE LOADER_FLASH_OFFS
+DEVICE_VARS += LOADER_TYPE LOADER_FLASH_OFFS LZMA_TEXT_START
DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
@@ -22,6 +22,7 @@ ldrplatform-$(CONFIG_TARGET_ramips_mt7621) := mt7621
ldrflashstart-y := 0x1c000000
ldrflashstart-$(CONFIG_TARGET_ramips_mt7621) := 0x1fc00000
+LOADADDR := $(loadaddr-y)
LOADER_PLATFORM := $(ldrplatform-y)
LOADER_FLASH_START := $(ldrflashstart-y)
@@ -45,7 +46,8 @@ define Build/loader-common
PKG_BUILD_DIR="$@.src" \
TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
BOARD="$(BOARDNAME)" PLATFORM="$(LOADER_PLATFORM)" \
- LZMA_TEXT_START=0x81800000 LOADADDR=$(KERNEL_LOADADDR) \
+ LZMA_TEXT_START=$(LZMA_TEXT_START) \
+ LOADADDR=$(LOADADDR) \
$(1) compile loader.$(LOADER_TYPE)
mv "$@.$(LOADER_TYPE)" "$@"
rm -rf $@.src
@@ -176,6 +178,7 @@ define Device/Default
PROFILES = Default
KERNEL := $(KERNEL_DTB) | uImage lzma
KERNEL_LOADADDR := $(loadaddr-y)
+ LZMA_TEXT_START := 0x81800000
SOC := $(DEFAULT_SOC)
DEVICE_DTS_DIR := ../dts
DEVICE_DTS = $$(SOC)_$(1)
diff --git a/target/linux/ramips/image/common-sercomm.mk b/target/linux/ramips/image/common-sercomm.mk
new file mode 100644
index 0000000000..e96cba879c
--- /dev/null
+++ b/target/linux/ramips/image/common-sercomm.mk
@@ -0,0 +1,87 @@
+DEVICE_VARS += SERCOMM_KERNEL_OFFSET SERCOMM_ROOTFS_OFFSET
+
+define Build/sercomm-crypto
+ $(TOPDIR)/scripts/sercomm-crypto.py \
+ --input-file $@ \
+ --key-file $@.key \
+ --output-file $@.ser \
+ --version $(SERCOMM_SWVER)
+ $(STAGING_DIR_HOST)/bin/openssl enc -md md5 -aes-256-cbc \
+ -in $@ \
+ -out $@.enc \
+ -K `cat $@.key` \
+ -iv 00000000000000000000000000000000
+ dd if=$@.enc >> $@.ser 2>/dev/null
+ mv $@.ser $@
+ rm -f $@.enc $@.key
+endef
+
+define Build/sercomm-kernel
+ $(TOPDIR)/scripts/sercomm-kernel-header.py \
+ --kernel-image $@ \
+ --kernel-offset $(SERCOMM_KERNEL_OFFSET) \
+ --rootfs-offset $(SERCOMM_ROOTFS_OFFSET) \
+ --output-header $@.hdr
+ dd if=$@ >> $@.hdr 2>/dev/null
+ mv $@.hdr $@
+endef
+
+define Build/sercomm-part-tag
+ $(call Build/sercomm-part-tag-common,$(word 1,$(1)) $@)
+endef
+
+define Build/sercomm-part-tag-common
+ $(eval file=$(word 2,$(1)))
+ $(TOPDIR)/scripts/sercomm-partition-tag.py \
+ --input-file $(file) \
+ --output-file $(file).tmp \
+ --part-name $(word 1,$(1)) \
+ --part-version $(SERCOMM_SWVER)
+ mv $(file).tmp $(file)
+endef
+
+define Build/sercomm-payload
+ $(TOPDIR)/scripts/sercomm-pid.py \
+ --hw-version $(SERCOMM_HWVER) \
+ --hw-id $(SERCOMM_HWID) \
+ --sw-version $(SERCOMM_SWVER) \
+ --pid-file $@.pid \
+ --extra-padding-size 0x10 \
+ --extra-padding-first-byte 0x0a
+ $(TOPDIR)/scripts/sercomm-payload.py \
+ --input-file $@ \
+ --output-file $@.tmp \
+ --pid "$$(cat $@.pid | od -t x1 -An -v | tr -d '\n')"
+ mv $@.tmp $@
+ rm $@.pid
+endef
+
+define Build/sercomm-prepend-tagged-kernel
+ $(CP) $(IMAGE_KERNEL) $(IMAGE_KERNEL).tagged
+ $(call Build/sercomm-part-tag-common,$(word 1,$(1)) \
+ $(IMAGE_KERNEL).tagged)
+ dd if=$@ >> $(IMAGE_KERNEL).tagged 2>/dev/null
+ mv $(IMAGE_KERNEL).tagged $@
+endef
+
+define Device/sercomm_dxx
+ $(Device/dsa-migration)
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ KERNEL_SIZE := 6144k
+ UBINIZE_OPTS := -E 5
+ LOADER_TYPE := bin
+ KERNEL_LOADADDR := 0x81001000
+ LZMA_TEXT_START := 0x82800000
+ KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 | \
+ uImage lzma | sercomm-kernel
+ KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | \
+ lzma -a0 | uImage lzma
+ IMAGES += factory.img
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ IMAGE/factory.img := append-ubi | sercomm-part-tag rootfs | \
+ sercomm-prepend-tagged-kernel kernel | gzip | sercomm-payload | \
+ sercomm-crypto
+ SERCOMM_KERNEL_OFFSET := 0x400100
+ SERCOMM_ROOTFS_OFFSET := 0x1000000
+endef
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index aa7adeee60..f79ba5fb5a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -2,6 +2,7 @@
# MT7621 Profiles
#
+include ./common-sercomm.mk
include ./common-tp-link.mk
DEFAULT_SOC := mt7621
@@ -285,6 +286,19 @@ define Device/beeline_smartbox-flash
endef
TARGET_DEVICES += beeline_smartbox-flash
+define Device/beeline_smartbox-giga
+ $(Device/sercomm_dxx)
+ IMAGE_SIZE := 24576k
+ SERCOMM_HWID := DBE
+ SERCOMM_HWVER := 10100
+ SERCOMM_SWVER := 1001
+ DEVICE_VENDOR := Beeline
+ DEVICE_MODEL := SmartBox GIGA
+ DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \
+ kmod-usb3 uboot-envtools
+endef
+TARGET_DEVICES += beeline_smartbox-giga
+
define Device/buffalo_wsr-1166dhp
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)