Commit Graph

26708 Commits

Author SHA1 Message Date
Rui Salvaterra
03f41b1eb2 mvebu: add Linux 5.15 as testing kernel
Run-tested on the cortexa9 subtarget (Turris Omnia).

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:38:46 +01:00
Rui Salvaterra
53c969e97e mvebu: update the kconfigs for 5.15
And remove irrelevant stuff while at it.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:38:46 +01:00
Rui Salvaterra
3f4990ce0f mvebu: copy 5.10 kconfigs to 5.15
Will be refreshed/updated later.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:38:46 +01:00
Rui Salvaterra
7d139bd5f3 mvebu: refresh 5.15 patches
Deleted (upstreamed):
303-linksys_hardcode_nand_ecc_settings.patch [1]

Deleted (not needed):
314-arm64-dts-uDPU-switch-PHY-operation-mode-to-2500base.patch [2]

Manually rebased:
700-mvneta-tx-queue-workaround.patch

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4daff3e5b42422cd4af758cc7768223d2b7f6e14
[2] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=7f73acade0cde61341cb77e0dc74de51ac059d4f

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:38:31 +01:00
Rui Salvaterra
fb29b91c5b mvebu: remove all ≤ 5.15-tagged patches
They're already upstream.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:28:32 +01:00
Rui Salvaterra
05cd4a59f0 mvebu: copy 5.10 patches to 5.15
Linux 5.15 on Marvell EBU, here we go!

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-08-16 22:28:32 +01:00
Tomas Lara
24307b0351 kernel: remove CONFIG_MMC_BLOCK_BOUNCE
CONFIG_MMC_BLOCK_BOUNCE was removed in kernel v4.13-rc1
 c3dccb74be

Signed-off-by: Tomas Lara <tl849670@gmail.com>
2022-08-13 21:02:35 +02:00
Josef Schlehofer
049368b936 mvebu: backport pending Turris Omnia LEDs improvements
It backports this patch series, which is currently on review:
https://lore.kernel.org/linux-leds/20220704105955.15474-1-kabel@kernel.org/T/#rb89a4ca5a836f17bdcc53d65549e0b1779bb6a18
It allows being able to configure LEDs in userspace.

This fixes issue described in Turris Build repository
https://gitlab.nic.cz/turris/os/build/-/issues/354
It happens in OpenWrt as well.

- Before
```
root@turris:/# ls /sys/class/leds/
ath10k-phy0  ath9k-phy1   mmc0::
```

 -After
```
root@turris:/# ls /sys/class/leds/
ath10k-phy0      rgb:indicator-2  rgb:lan-3        rgb:wlan-1
ath9k-phy1       rgb:lan-0        rgb:lan-4        rgb:wlan-2
mmc0::           rgb:lan-1        rgb:power        rgb:wlan-3
rgb:indicator-1  rgb:lan-2        rgb:wan
```

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
2022-08-13 20:53:10 +02:00
Josef Schlehofer
2ae26f523e mvebu: backport DTS changes for Turris Omnia from mvebu/dt
My commit backported patches from the following links:
- https://lore.kernel.org/linux-arm-kernel/20220704113622.18887-1-kabel@kernel.org/
- https://lore.kernel.org/linux-arm-kernel/20220704113622.18887-2-kabel@kernel.org/

According to the links, they are applied in repository mvebu in branch dt,
so it should be included in upcoming Linux version soon.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
2022-08-13 20:53:10 +02:00
Lech Perczak
9f5cbb6e8b ath25: fix initramfs image generation
Commit 21f460a5db ("ath25: fix duplicate LZMA compression") changed
the way kernel images are generated, affecting initramfs images instead.
Initramfs images were previously ELF images, and by mistake this change
caused the raw kernel image to be used as a source. This caused them to
be non-loadable by bootloaders.

Restore the previous KERNEL_INITRAMFS recipe and adjust
KERNEL_INITRAMFS_NAME to point at the correct source artifact.
While at that, adjust KERNEL_INITRAMFS_SUFFIX to -kernel.elf,
so it matches the suffix of non-initramfs kernel artifact.

Fixes: 21f460a5db ("ath25: fix duplicate LZMA compression")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2022-08-13 20:52:37 +02:00
Lech Perczak
611291383a ath25: fix ELF image generation
Commit 21f460a5db ("ath25: fix duplicate LZMA compression"), when
attempting to restore ELF artifact generation, copiedover the raw
kernel image twice. Because of that, the .elf artifact was actually a
duplicate of raw image.

Fix that by copying over .elf suffixed kernel image instead.

Fixes: 21f460a5db ("ath25: fix duplicate LZMA compression")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2022-08-13 20:52:37 +02:00
Mikhail Zhilkin
85b41cbd3b ramips: add support for Beeline SmartBox TURBO
Beeline SmartBox TURBO is a wireless WiFi 5 router manufactured by
Sercomm company.

Device specification
--------------------
SoC Type: MediaTek MT7621AT
RAM: 256 MiB
Flash: 256 MiB, Micron MT29F2G08ABAGA3W
Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2
Wireless 5 GHz (MT7615E): a/n/ac, 4x4
Ethernet: 5xGbE (WAN, LAN1, LAN2, LAN3, LAN4)
USB ports: 1xUSB3.0
Button: 2 buttons (Reset & WPS)
LEDs: 1 RGB LED
Power: 12 VDC, 1.5 A
Connector type: barrel
Bootloader: U-Boot

Installation
-----------------
1.  Login to the router web interface (admin:admin)
2.  Navigate to Settings -> WAN -> Add static IP interface (e.g.
    10.0.0.1/255.255.255.0)
3.  Navigate to Settings -> Remote cotrol -> Add SSH, port 22,
    10.0.0.0/255.255.255.0 and interface created before
4.  Change IP of your client to 10.0.0.2/255.255.255.0 and connect the
    ethernet cable to the WAN port of the router
5.  Connect to the router using SSH shell (SuperUser:SNxxxxxxxxxx, where
    SNxxxxxxxxxx is the serial number from the backplate label)
6.  Run in SSH shell:
       sh
7.  Make a mtd backup (optional, see related section)
8.  Change bootflag to Sercomm1 and reboot:
       printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3
       reboot
9.  Login to the router web interface (admin:admin)
10. Remove dots from the OpenWrt factory image filename
11. Update firmware via web using OpenWrt factory image

Revert to stock
---------------
1. Change 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.

mtd backup
----------
1. Set up a tftp server (e.g. tftpd64 for windows)
2. Connect to a router using SSH shell and run the following commands:
      cd /tmp
      for i in 0 1 2 3 4 5 6 7 8 9 10; do nanddump -f mtd$i /dev/mtd$i; \
      tftp -l mtd$i -p 10.0.0.2; md5sum mtd$i >> mtd.md5; rm mtd$i; done
      tftp -l mtd.md5 -p 10.0.0.2

MAC Addresses
-------------
+-----+-----------+---------+
| use | address   | example |
+-----+-----------+---------+
| LAN | label     | *:54    |
| WAN | label + 1 | *:55    |
| 2g  | label + 4 | *:58    |
| 5g  | label + 5 | *:59    |
+-----+-----------+---------+
The label MAC address was found in Factory 0x21000

Co-developed-by: Maximilian Weinmann <x1@disroot.org>
Signed-off-by: Maximilian Weinmann <x1@disroot.org>
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2022-08-13 20:52:37 +02:00
Alexandru Gagniuc
6d5873a162 realtek: add support for TP-Link SG2008P
Add support for the TP-Link SG2008P switch. This is an RTL8380 based
switch with 802.3af one the first four ports.

Specifications:
---------------
 * SoC:       Realtek RTL8380M
 * Flash:     32 MiB SPI flash (Vendor varies)
 * RAM:       256 MiB (Vendor varies)
 * Ethernet:  8x 10/100/1000 Mbps with PoE on 4 ports
 * Buttons:   1x "Reset" button on front panel
 * Power:     53.5V DC barrel jack
 * UART:      1x serial header, unpopulated
 * PoE:       1x TI TPS23861 I2C PoE controller

Works:
------
  - (8) RJ-45 ethernet ports
  - Switch functions
  - System LED

Not yet enabled:
----------------
  - Power-over-Ethernet (driver works, but doesn't enable "auto" mode)
  - PoE, Link/Act, PoE max and System LEDs

Install via web interface:
-------------------------

Not supported at this time.

Install via serial console/tftp:
--------------------------------

The footprints R27 (0201) and R28 (0402) are not populated. To enable
serial console, 50 ohm resistors should be soldered -- any value from
0 ohm to 50 ohm will work. R27 can be replaced by a solder bridge.

The u-boot firmware drops to a TP-Link specific "BOOTUTIL" shell at
38400 baud. There is no known way to exit out of this shell, and no
way to do anything useful.

Ideally, one would trick the bootloader into flashing the sysupgrade
image first. However, if the image exceeds 6MiB in size, it will not
work. The sysupgrade image can also be flashed. To install OpenWRT:

Prepare a tftp server with:
 1. server address: 192.168.0.146
 2. the image as: "uImage.img"

Power on device, and stop boot by pressing any key.
Once the shell is active:
 1. Ground out the CLK (pin 16) of the ROM (U7)
 2. Select option "3. Start"
 3. Bootloader notes that "The kernel has been damaged!"
 4. Release CLK as sson as bootloader thinks image is corrupted.
 5. Bootloader enters automatic recovery -- details printed on console
 6. Watch as the bootloader flashes and boots OpenWRT.

Blind install via tftp:
-----------------------

This method works when it's not feasible to install a serial header.

Prepare a tftp server with:
 1. server address: 192.168.0.146
 2. the image as: "uImage.img"
 3. Watch network traffic (tcpdump or wireshark works)
 4. Power on the device.
 5. Wait 1-2 seconds then ground out the CLK (pin 16) of the ROM (U7)
 6. When 192.168.0.30 makes tftp requests, release pin 16
 7. Wait 2-3 minutes for device to auto-flash and boot OpenWRT

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2022-08-13 19:59:47 +02:00
Alexandru Gagniuc
c5fbd49d3f kernel: add upstream patches for tps23861 PoE controller
These patches support the tps23861 PoE controller found on a number of
managed switches. The TPS23861 is an I2C-based quad IEEE 802.3at (PoE+)
Power-over-Ethernet PSE controller. It's also found on some Realtek
based switches, where we expect the bulk of the users to reside.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
[Disable driver in generic/config-5.10]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2022-08-13 19:59:15 +02:00
Alexandru Gagniuc
7bba7ccde9 realtek: EnGenius EWS2910P: use the mtd3 partition for root overlay
The root overlay is mounted on the "rootfs_data" partition. This comes
at the end of the firmware image, courtesy of mtdsplit. There is very
little space left (About 1MB), which can fill up rapidly.

The "firmware" and "firmware2" partitions are part of the bootloader
dual firmware logic. They should contain independent, valid uImages.
This leaves "jffs2-cfg" (mtd3) and "jffs2-log" (mtd4) as candidates.

mtd3 is about 13.7 MB and is used by the vendor firmware to store
configuration settings. It is only erased by vendor firmware during a
factory reset. By naming this partition "rootfs_data", it becomes the
root overlay, providing significantly more room. Even with mtdsplit
wanting to create a "rootfs_data" on the firmware partition, mtd3 is
used as the overlay.

Rename "jffs2-cfg" to "rootfs_data", and profit from the extra space.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2022-08-13 19:19:38 +02:00
Sander Vanheule
225137608c realtek: Netgear GS110TPP v1: add lan9 and lan10
The original commit for the GS110TP was missing ports 9 and 10. These
are provided by an external RTL8214C phy, for which no support was
available at the time. Now that this phy is supported, add the missing
entries to enable all device ports.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2022-08-13 19:15:46 +02:00
Paul Spooren
ead7e5b4c3 realtek: skip SFP ports in PoE setup
The function `ucidef_set_poe` receives a list of ports to add to the PoE array.
Since switches have many ports the varibale `lan_list` is passed instead of
writing every single lan port. However, this list includes partly SFP ports
which are unrelated to PoE.

This commits adds the option to add a third parameter to manually exclide
interfaces, usually the last two.

Signed-off-by: Paul Spooren <mail@aparcar.org>
[Replace glob by regex to be more specific about matching characters]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2022-08-13 19:15:46 +02:00
John Audia
2239ead6eb kernel: bump 5.10 to 5.10.136
All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-08-12 00:01:41 +02:00
Hauke Mehrtens
96ef2dabce kernel: Backport upstream flowtable patches from 5.15
This backports some patches from kernel 5.15 to fix issues with
flowtable offloading in kernel 5.10. OpenWrt backports most of the
patches related to flowtable offloading from kernel 5.15 already, but we
are missing some of the extra fixes.

This fixes some connection tracking problems when a flow gets removed
from the offload and added to the normal SW path again.

The patch 614-v5.18-netfilter-flowtable-fix-TCP-flow-teardown.patch was
extended manually with the nf_conntrack_tcp_established() function.

All changes are already included in kernel 5.15.

Fixes: #8776
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-12 00:00:13 +02:00
John Audia
5238a87c20 kernel: bump 5.15 to 5.15.60
All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-08-11 19:38:10 +02:00
Hauke Mehrtens
3b5294beb7 kernel: kmod-wwan: Add package
This adds the kmod-wwan package. This provides the generic wwan driver
core which is needed for some existing packages.

Currently the drivers/net/wwan/wwan.ko driver is compiled into the
kernel when one of the wwan module is activated, better build it as a
kernel module.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-10 21:36:17 +02:00
Hauke Mehrtens
b75425370d kernel: kmod-nft-nat6: Remove package
The nft NAT packages for IPv4 and IPv6 were merged into the common
packages with kernel 5.1. The kmod-nft-nat6 package was empty in our
build, remove it.

Multiple kernel configuration options were also removed, remove them
from our generic kernel configuration too.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-10 21:36:17 +02:00
Hauke Mehrtens
ff06edd1f0 kernel: Activate CONFIG_GPIOLIB in generic configuration
All targets expect the malta target already activate the CONFIG_GPIOLIB
option. Move it to generic kernel configuration and also activate it for
malta.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-10 21:36:17 +02:00
Hauke Mehrtens
0e3bafc601 kernel: Activate CONFIG_INPUT_MISC on all targets
CONFIG_INPUT_MISC does not do any changes to the kernel image, it only
shows some extra kernel configuration options.

Activate it on all targets.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-10 21:36:17 +02:00
Koen Vandeputte
cf110404e3 kernel: properly condition EM919x patch
Properly format and refresh patch

Fixes: d03977faf4 ("kernel: backport support for Sierra Wireless EM919x modems")

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2022-08-09 13:57:39 +02:00
Jo-Philipp Wich
b5ec04f81a Revert "nftables: fix parsing date expressions"
This reverts commit eada892577.

The commit contained unrelated target changes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-09 11:50:52 +02:00
Jo-Philipp Wich
eada892577 nftables: fix parsing date expressions
Musl libc does not support the non-POSIX "%F" format for strptime() so
replace all occurrences of it with an equivalent "%Y-%m-%d" format.

Fixes: #10419
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-09 00:20:14 +02:00
Koen Vandeputte
1bfe42beb4 kernel: add missing 5.15 symbols
Found while testing various platforms

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2022-08-08 15:37:34 +02:00
Koen Vandeputte
4e4a457d37 kernel: backport support for Sierra Wireless EM919x modems
Adds support for Sierra Wireless EM919x modem (X55 5G)
Backported from kernel 5.16

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2022-08-08 15:37:34 +02:00
André Valentin
2cc5059240 ramips: add support for ZyXEL LTE3301-Plus
The ZyXEL LTE3301-PLUS is an 4G indoor CPE with 2 external LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7615E
 - Switch: 4 LAN ports (Gigabit)
 - LTE: Quectel EG506 connected by USB3 to SoC
 - SIM: 1 micro-SIM slot
 - USB: USB3 port
 - Buttons: Reset, WPS
 - LEDs: Multicolour power, internet, LTE, signal, Wifi, USB
 - Power: 12V, 1.5A

The device is built as an indoor ethernet to LTE bridge or router with
Wifi.

UART Serial:

57600N1
Located on populated 5 pin header J5:

 [o] GND
 [ ] key - no pin
 [o] RX
 [o] TX
 [o] 3.3V Vcc

MAC assignment:
lan:  98:0d:67:ee:85:54 (base, on the device back)
wlan: 98:0d:67:ee:85:55

Installation from web GUI:

- Log in as "admin" on http://192.168.1.1/
- Upload OpenWrt initramfs-recovery.bin image on the
  Maintenance -> Firmware page
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- format ubi device: ubiformat /dev/mtd6
- attach ubi device: ubiattach -m6
- create rootfs volume: ubimkvol /dev/ubi0 -n0 -N rootfs -s 1MiB
- rootfs_data volume: ubimkvol /dev/ubi0 -n1 -N rootfs_data -s 1MiB
- run sysupgrade with sysupgrade image

For more details about flashing see
commit 2449a63208 ("ramips: mt7621: Add support for ZyXEL NR7101").

Please note that this commit is needed:
firmware-utils: add marcant changes for ZyXEL NBG6716 and LTE3301-PLUS

Signed-off-by: André Valentin <avalentin@marcant.net>
2022-08-06 20:33:59 +02:00
Manuel Niekamp
0dc5821489 ath79: add support for Sophos AP15
The Sophos AP15 seems to be very close to Sophos AP55/AP100.

Based on:
commit 6f1efb2898 ("ath79: add support for Sophos AP100/AP55 family")
author    Andrew Powers-Holmes <andrew@omnom.net>
          Fri, 3 Sep 2021 15:53:57 +0200 (23:53 +1000)
committer Hauke Mehrtens <hauke@hauke-m.de>
          Sat, 16 Apr 2022 16:59:29 +0200 (16:59 +0200)

Unique to AP15:
 - Green and yellow LED
 - 2T2R 2.4GHz 802.11b/g/n via SoC WMAC
 - No buttons
 - No piezo beeper
 - No 5.8GHz

Flashing instructions:
 - Derived from UART method described in referenced commit, methods
   described there should work too.
 - Set up a TFTP server; IP address has to be 192.168.99.8/24
 - Copy the firmware (initramfs-kernel) to your TFTP server directory
   renaming it to e.g. boot.bin
 - Open AP's enclosure and locate UART header (there is a video online)
 - Terminal connection parameters are 115200 8/N/1
 - Connect TFTP server and AP via ethernet
 - Power up AP and cancel autoboot when prompted
 - Prompt shows 'ath> '
 - Commands used to boot:
    ath> tftpboot 0x81000000 boot.bin
    ath> bootm 0x81000000
 - Device should boot OpenWRT
 - IP address after boot is 192.168.1.1/24
 - Connect to device via browser
 - Permanently flash using the web ui (flashing sysupgrade image)
 - (BTW: the AP55 images seem to work too, only LEDs are not working)

Testing done:
 - To be honest: Currently not so much testing done.
 - Flashed onto two devices
 - Devices are booting
 - MAC addresses are correct
 - LEDs are working
 - Scanning for WLANs is working

Big thanks to all the people working on this great project!
(Sorry about my english, it is not my native language)

Signed-off-by: Manuel Niekamp <m.niekamp@richter-leiterplatten.de>
2022-08-06 20:33:59 +02:00
Jan-Niklas Burfeind
75dffdc8cf ath79: add variant UniFi AP LR
The hardware difference is the antenna which has a higher gain compared
to the original UniFi AP.

The variant was supported before in ar71xx.

Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
2022-08-06 20:15:30 +02:00
Jan-Niklas Burfeind
50e1f3d84d ath79: rename references of UniFi to UniFi AP
extract the compatible and model to make room for other variants

follow-up of
commit dc23df8a8c ("ath79: change Ubiquiti UniFi AP model name to include "AP"")

Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
2022-08-06 20:15:30 +02:00
Reto Schneider
2293f1abe4 ramips: mt7628: fix memory controller reset bit
According to MediaTek MT7688 Datasheet v1.4, as well as the MT7628
counterpart, the memory controller reset bit (MC_RST) is 10, not 20.
Reset bit 20 is used for for UART 2 (UART2_RST).

Please note: Due to the lack of hardware, I was not able to test this
change.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-08-06 19:58:46 +02:00
David Yang
577f3fdbc9 ramips: add support for Netcore NW5212
This patch adds support for Netcore NW5212, provided by some carrier in
China.

Specifications:
--------------

* SoC: Mediatek MT7620A
* RAM: 128MB DDR2
* Flash: 16MB SPI NOR flash (Winbond W25Q128BV)
* WiFi 2.4GHz: builtin
* Ethernet: builtin
* LED: Power, WAN, LAN 1-4, WiFi
* Buttons: Reset (GPIO 13)
* UART: Serial console (57600 8n1)
* USB: 1 x USB2

Installation:
------------

The router comes with OpenWrt 14.07 built with MTK SDK. However, as the
modem is provided by carriers, so the web interface is highly minimized and
only contains a static page with no interaction options.

There are two possible ways to gain the access.

1) Open the shell and use a UART2USB convert to gain TTY access. Please
   notice you have to remove resistance R54 at the back of the board
   otherwise you won't be able to input anything.
2) Use built-in backdoor. Access http://192.168.1.1/cgi-bin/_/testxst to
   start dropbear service at port 9122. Be warned the software is super
   old and only diffie-hellman-group1-sha1, diffie-hellman-group14-sha1,
   kexguess2@matt.ucc.asn.au is support, you may not be able to connect it
   with an up-to-date ssh client.

After you can control the device, flash the firmware as usual. Here are
some hints for that.

Option 1 (via original firmware):

1) Setup HTTP server on your computer, for example:
     python3 -m http.server
2) Connect to the route and flash:
     cd /tmp
     wget http://<your-computer-host>/<your-firmware-name>
     mtd -r write <your-firmware-name> firmware

Option 2 (replacing u-boot via breed):

1) Download breed-mt7620-reset13.bin from https://breed.hackpascal.net/
2) Setup HTTP server on your computer, for example:
     python3 -m http.server
   You can skip this step if your breed is already accessible from HTTP,
   since the original wget does not support HTTPS.
3) Connect to the route and flash breed:
     cd /tmp
     wget http://<your-computer-host>/breed-mt7620-reset13.bin
     mtd write breed-mt7620-reset13.bin Bootloader
4) Reboot. Hold reset key or press any key in TTY to enter breed.
5) Access breed web interface (http://192.168.1.1/). Choose the flash
   layout to be 0x50000 and flash new firmware.

MAC addresses:
-------------

There are three MACs stored in factory, as in MT7620A reference design:

source address   usage
   0x4 label     WLAN
  0x28 label     MAC 1
  0x2e label + 1 MAC 2

However, the OEM firmware only uses one single MAC (label) for all
interfaces, probably a misconfiguration.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2022-08-06 19:58:46 +02:00
David Yang
b00a02aaa0 ramips: add support for Netgear PR2000
This patch adds support for Netgear PR2000, sold as "Travel Router and
Range Extender".

Specifications:
--------------

* SoC: Mediatek MT7620N
* RAM: 64MB DDR2
* Flash: 16MB SPI NOR flash (Macronix MX25L12805D)
* WiFi 2.4GHz: builtin
* Ethernet: builtin
* LED: Power, Internet, WiFi, USB
* Buttons: Reset (GPIO 1/2)
* UART: Serial console (57600 8n1)
* USB: 1 x USB2

SPECIAL NOTES:
-------------

Problem: WiFi is super weak, but SSID beacons seems to be right.

Solve: Change 36h in factory partition (namely 0xf60036) to be 0x0.

Explain: Clearly Netgear have different ideas on how EEPROM is used. Bit 2
of 36h indicates the presence of External LNA for 11g (2.4 GHz) band,
which seems to be incorrectly set by Netgear (originally 0x04). Lifting it
solves the problem of weak RX signal.

Installation:
------------

There are two possible ways to install the firmware. Flashing via web
interface of original firmware is not tested due to a broken firmware.

1) Open the shell and use a UART2USB convert to gain TTY access (TP7: RXD,
   TP9: TXD, TP10: GND). Please notice you have to remove resistance R54
   next to TP7 otherwise you won't be able to input anything.
2) Use well-known Netgear debug switch. Access
   http://192.168.168.1/setup.cgi?todo=debug to start telnet service
   (username: root, password: <none>).

Please back up firmware if you want to go back to the original.

After you can control the device, flash the firmware as usual. Here are
some hints for that.

Option 1 (via nmrpflash):

1) Download nmrpflash from https://github.com/jclehner/nmrpflash
2) Use *-factory.img and flash:
     nmrpflash -L
     nmrpflash -i net* -f <your-firmware-name>
3) Turn off then turn on the device, wait it finishing flash.

Option 2 (replacing u-boot via breed):

1) Download breed-mt7620-reset1.bin from https://breed.hackpascal.net/
2) Setup HTTP server on your computer, for example:
     python3 -m http.server
   You can skip this step if your breed is already accessible from HTTP,
   since the original wget does not support HTTPS.
3) Connect to the route and flash breed:
     cd /tmp
     wget http://<your-computer-host>/breed-mt7620-reset1.bin
     dd if=breed-mt7620-reset1.bin of=/dev/mtdblock0 bs=64k
4) Reboot. Hold reset key or press any key in TTY to enter breed.
5) Access breed web interface (http://192.168.1.1/). Choose memory layout
   to be 0x40000 and flash new firmware.

Remark:
------

As a "Range Extender", it has a switch to switch between Wired mode (GPIO
21 low) and Wireless mode (GPIO 20 low), which is not implemented in this
patch. However, the router will be turned off when it switches to the
middle, which makes this switch much less useful.

MAC addresses:
-------------

The OEM firmware uses one single MAC for all interfaces, located at
0xf700b0.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2022-08-06 19:58:46 +02:00
Lea Teuberth
45255aa0e8 ramips: adding support for Asus RP-AC56
Specifications:
	CPU:     MT7621A dual-core 880MHz
	RAM:     64MB DDR2
	FLASH:   16MB MX25L12805D NOR SPI
	WIFI:    2.4GHz 2x2 MT7603 b/g/n PCI
	WIFI:    5GHz 2x2 MT7662 a/b/ac PCI
	ETH:     1xLAN 1000base-T integrated
	SWITCH:  MT7530 Port 0: LAN, Port 6: CPU
	LED:     Power, 2.4GHz WiFi, 5GHz WiFi
	BTN:     WPS, Reset
	UART:    Near ETH port, from ETH: 3V3-TxD-GND-RxD 57600 8n1
	MISC:    Audio support

Installation:
	1. Update using recovery mode
	   - while holdig "reset" button, power on the device
	   - keep holding "reset" until power led is flashing yellow
	   - set own IP to 192.168.1.75, subnet mask: 255.255.255.0
	   - push firmware image (can be factory.bin or sysupgrade.bin)
	     using tftp client in binary mode to 192.168.1.1

Notes:
	This board has only two MAC addresses programmed in the "factory" partition:
	- MAC for wlan0 (2.4GHz) at offset 0x0004
	- MAC for wlan1 (5GHz) at offset 0x8004
	- stock firmware re-uses wlan0 MAC for ethernet
	- no valid addresses found in 0x28, 0x2e, 0xe000 and 0xe006

Signed-off-by: Lea Teuberth <lea.teuberth@outlook.com>
2022-08-06 19:58:46 +02:00
John Audia
ccff2fbaea kernel: bump 5.10 to 5.10.135
All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-08-06 19:58:46 +02:00
John Audia
122b625e74 kernel: bump 5.15 to 5.15.59
Patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-08-06 19:58:46 +02:00
Petr Štetiar
98df6bd99c generic: 5.15: disable CONFIG_DEBUG_INFO_REDUCED symbol
This came up during build testing of mvebu/cortexa9 target with 5.15
kernel.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-08-06 15:00:08 +02:00
INAGAKI Hiroshi
cef3f05a55 realtek: add support for Panasonic Switch-M48eG PN28480K
Panasonic Switch-M48eG PN28480K is a 48 + 4 port gigabit switch, based on
RTL8393M.

Specification:

- SoC           : Realtek RTL8393M
- RAM           : DDR3 128 MiB (Winbond W631GG8KB-15)
- Flash         : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G)
- Ethernet      : 10/100/1000 Mbps x48 + 2
  - port  1-40  : TP, RTL8218B x5
  - port 41-48  : RTL8218FB
    - port 41-44: TP
    - port 45-48: TP/SFP (Combo)
- LEDs/Keys     : 7x / 1x
- UART          : RS-232 port on the front panel (connector: RJ-45)
  - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45)
  - 9600n8
- Power         : 100-240 VAC, 50/60 Hz, 0.5 A
  - Plug        : IEC 60320-C13
- Stock OS      : VxWorks based

Flash instruction using initramfs image:

1.  Prepare the TFTP server with the IP address 192.168.1.111
2.  Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to
    the TFTP directory
3.  Download the official upgrading firmware (ex: pn28480k_v30000.rom)
    and place it to the TFTP directory
4.  Boot M48eG and interrupt the U-Boot with Ctrl + C keys
5.  Execute the following commands and boot with the OpenWrt initramfs
    image

    rtk network on
    tftpboot 0x81000000
    bootm

6.  Backup mtdblock files to the computer by scp or anything and reboot
7.  Interrupt the U-Boot and execute the following commands to re-create
    filesystem in the flash

    ffsmount c:/
    ffsfmt c:/

    this step takes a long time, about ~ 4 mins

8.  Execute the following commands to put the official images to the
    filesystem

    updatert <official image>

    example:

      updatert pn28480k_v30000.rom

    this step takes about ~ 40 secs

9.  Set the environment variables of the U-Boot by the following commands

    setenv loadaddr 0xb4e00000
    setenv bootcmd 'sleep 10; bootm;'
    saveenv

    'sleep 10;' is required as dummy to execute 'bootm' command correctly

10: Download the OpenWrt initramfs image and boot with it

    tftpboot 0x81000000 0101A8C0.img
    bootm

11: On the initramfs image, download the sysupgrade image and perform
    sysupgrade with it

    sysupgrade <imagename>

12: Wait ~ 120 seconds to complete flashing

Known Issues:

- 4x SFP ports are provided as combo ports by the RTL8218FB chip, but the
  phy driver has no support for it. Currently, only TP ports work by the
  RTL8218B support.

Note:

- "Switch-M48eG" is a model name, and "PN28480K" is a model number.
  Switch-M48eG has an another (old) model number ("PN28480"), it's not a
  Realtek based hardware.

- Switch-M48eG has a "POWER" LED (Green), but it's not connected to any
  GPIO pin.

- U-Boot checks the runtime images in the flash when booting and fails
  to execute "bootcmd" variable if the images are not existing.

- A filesystem is formed in the flash (0x100000-0x1DFFFFF) on the stock
  firmware and it includes the stock images, configuration files and
  checksum files. It's unknown format, can't be managed on the OpenWrt.
  To get the enough space for OpenWrt, move the filesystem to the head
  of "fs_reserved" partition by execution of "ffsfmt" and "updatert".

- A GPIO pin on PCA9539 is used for resetting external RTL8218B phys and
  RTL8218FB phy.
  This should be specified as "reset-gpios" property in MDIO node, but
  the current configuration of RTL8218B phy in the driver seems to be
  incomplete and RTL8218FB won't be configured on RTL8218D support.
  So, ethernet ports on these phys will be broken after hard-resetting.
  At the moment, configure this pin as gpio-hog to avoid breaking by
  resetting.

- This model has 2x Microchip TCN75A thermal sensors. Linux Kernel
  supports TCN75 chip on lm75 driver, but no support for TCN75'A'
  variant.
  At the moment, use TCN75 support for the chips instead.

Back to the stock firmware:

1. Delete "loadaddr" variable and set "bootcmd" to the original value

   on U-Boot:

     setenv loadaddr
     setenv bootcmd 'ffsrdm c:/runtime.had 0x81000000;alphadec c:/runtime.had 0x81000240 0x80010000;'

   on OpenWrt:

     fw_setenv loadaddr
     fw_setenv bootcmd 'ffsrdm c:/runtime.had 0x81000000;alphadec c:/runtime.had 0x81000240 0x80010000;'

2. Perform reset or reboot

  on U-Boot:

    reset

  on OpenWrt:

    reboot

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-08-06 14:39:57 +02:00
INAGAKI Hiroshi
4974ee7341 realtek: enable pca953x GPIO driver for rtl839x subtarget
The system status LED on Panasonic Switch-M48eG PN28480K is connected to
a PCA9539PW. To use the LED as a status LED of OpenWrt while booting,
enable the pca953x driver and built-in to the kernel.
Also enable CONFIG_GPIO_PCA953X_IRQ to use interrupt via RTL83xx GPIO.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-08-06 14:39:57 +02:00
INAGAKI Hiroshi
fa52e5e254 realtek: add support for Panasonic Switch-M24eG PN28240K
Panasonic Switch-M24eG PN28240K is a 24 + 2 port gigabit switch, based on
RTL8382M.

Specification:

- SoC           : Realtek RTL8382M
- RAM           : DDR3 128 MiB (Winbond W631GG8KB-15)
- Flash         : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G)
- Ethernet      : 10/100/1000 Mbps x24 + 2
  - port  1-8   : TP, RTL8218B
  - port  9-16  : TP, RTL8218B (SoC)
  - port 17-24  : RTL8218FB
    - port 17-22: TP
    - port 23-24: TP/SFP (Combo)
- LEDs/Keys     : 7x / 1x
- UART          : RS-232 port on the front panel (connector: RJ-45)
  - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45)
  - 9600n8
- Power         : 100-240 VAC, 50/60 Hz, 0.5 A
  - Plug        : IEC 60320-C13
- Stock OS      : VxWorks based

Flash instruction using initramfs image:

1.  Prepare the TFTP server with the IP address 192.168.1.111
2.  Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to
    the TFTP directory
3.  Download the official upgrading firmware (ex: pn28240k_v30000.rom)
    and place it to the TFTP directory
4.  Boot M24eG and interrupt the U-Boot with Ctrl + C keys
5.  Execute the following commands and boot with the OpenWrt initramfs
    image

    rtk network on
    tftpboot 0x81000000
    bootm

6.  Backup mtdblock files to the computer by scp or anything and reboot
7.  Interrupt the U-Boot and execute the following commands to re-create
    filesystem in the flash

    ffsmount c:/
    ffsfmt c:/

    this step takes a long time, about ~ 4 mins

8.  Execute the following commands to put the official images to the
    filesystem

    updatert <official image>

    example:

      updatert pn28240k_v30000.rom

    this step takes about ~ 40 secs

9.  Set the environment variables of the U-Boot by the following commands

    setenv loadaddr 0xb4e00000
    setenv bootcmd bootm
    saveenv

10: Download the OpenWrt initramfs image and boot with it

    tftpboot 0x81000000 0101A8C0.img
    bootm

11: On the initramfs image, download the sysupgrade image and perform
    sysupgrade with it

    sysupgrade <imagename>

12: Wait ~ 120 seconds to complete flashing

Known Issues:

- 2x SFP ports are provided as combo ports by the RTL8218FB chip, but the
  phy driver has no support for it. Currently, only TP ports work by the
  RTL8218D support.

Note:

- "Switch-M24eG" is a model name, and "PN28240K" is a model number.
  Switch-M24eG has an another (old) model number ("PN28240"), it's not a
  Realtek based hardware.

- Switch-M24eG has a "POWER" LED (Green), but it's not connected to any
  GPIO pin.

- U-Boot checks the runtime images in the flash when booting and fails
  to execute "bootcmd" variable if the images are not existing.

- A filesystem is formed in the flash (0x100000-0x1DFFFFF) on the stock
  firmware and it includes the stock images, configuration files and
  checksum files. It's unknown format, can't be managed on the OpenWrt.
  To get the enough space for OpenWrt, move the filesystem to the head
  of "fs_reserved" partition by execution of "ffsfmt" and "updatert".

- A GPIO pin on PCA9539 is used for resetting external RTL8218B phy and
  RTL8218FB phy.
  This should be specified as "reset-gpios" property in MDIO node, but
  the current configuration of RTL8218B phy in the phy driver seems to
  be incomplete and RTL8218FB won't be configured on RTL8218D support.
  So, ethernet ports on these phys will be broken after hard-resetting.
  At the moment, configure this pin as gpio-hog to avoid breaking by
  resetting.

Back to the stock firmware:

1. Delete "loadaddr" variable and set "bootcmd" to the original value

   on U-Boot:

     setenv loadaddr
     setenv bootcmd 'bootm 0x81000000'

   on OpenWrt:

     fw_setenv loadaddr
     fw_setenv bootcmd 'bootm 0x81000000'

2. Perform reset or reboot

  on U-Boot:

    reset

  on OpenWrt:

    reboot

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-08-06 14:39:57 +02:00
INAGAKI Hiroshi
3d669ec9cd realtek: add support for Panasonic Switch-M16eG PN28160K
Panasonic Switch-M16eG PN28160K is a 16 + 2 port gigabit switch, based on
RTL8382M.

Specification:

- SoC           : Realtek RTL8382M
- RAM           : DDR3 128 MiB (Winbond W631GG8KB-15)
- Flash         : SPI-NOR 32 MiB (Macronix MX25L25635FMI-10G)
- Ethernet      : 10/100/1000 Mbps x16 + 2
  - port 1-8    : TP, RTL8218B (SoC)
  - port 9-16   : RTL8218FB
    - port  9-14: TP
    - port 15-16: TP/SFP (Combo)
- LEDs/Keys     : 7x / 1x
- UART          : RS-232 port on the front panel (connector: RJ-45)
  - 3:TX, 4:GND, 5:GND, 6:RX (pin number: RJ-45)
  - 9600n8
- Power         : 100-240 VAC, 50/60 Hz, 0.5 A
  - Plug        : IEC 60320-C13
- Stock OS      : VxWorks based

Flash instruction using initramfs image:

1.  Prepare the TFTP server with the IP address 192.168.1.111
2.  Rename the OpenWrt initramfs image to "0101A8C0.img" and place it to
    the TFTP directory
3.  Download the official upgrading firmware (ex: pn28160k_v30003.rom)
    and place it to the TFTP directory
4.  Boot M16eG and interrupt the U-Boot with Ctrl + C keys
5.  Execute the following commands and boot with the OpenWrt initramfs
    image

    rtk network on
    tftpboot 0x81000000
    bootm

6.  Backup mtdblock files to the computer by scp or anything and reboot
7.  Interrupt the U-Boot and execute the following commands to re-create
    filesystem in the flash

    ffsmount c:/
    ffsfmt c:/

    this step takes a long time, about ~ 4 mins

8.  Execute the following commands to put the official images to the
    filesystem

    updatert <official image>

    example:

      updatert pn28160k_v30003.rom

    this step takes about ~ 40 secs

9.  Set the environment variables of the U-Boot by the following commands

    setenv loadaddr 0xb4e00000
    setenv bootcmd bootm
    saveenv

10: Download the OpenWrt initramfs image and boot with it

    tftpboot 0x81000000 0101A8C0.img
    bootm

11: On the initramfs image, download the sysupgrade image and perform
    sysupgrade with it

    sysupgrade <imagename>

12: Wait ~ 120 seconds to complete flashing

Known Issues:

- 2x SFP ports are provided as combo ports by the RTL8218FB chip, but the
  phy driver has no support for it. Currently, only TP ports work by the
  RTL8218D support.

Note:

- "Switch-M16eG" is a model name, and "PN28160K" is a model number.
  Switch-M16eG has an another (old) model number ("PN28160"), it's not a
  Realtek based hardware.

- Switch-M16eG has a "POWER" LED (Green), but it's not connected to any
  GPIO pin.

- U-Boot checks the runtime images in the flash when booting and fails
  to execute "bootcmd" variable if the images are not existing.

- A filesystem is formed in the flash (0x100000-0x1DFFFFF) on the stock
  firmware and it includes the stock images, configuration files and
  checksum files. It's unknown format, can't be managed on the OpenWrt.
  To get the enough space for OpenWrt, move the filesystem to the head
  of "fs_reserved" partition by execution of "ffsfmt" and "updatert".

- A GPIO pin on PCA9539 is used for resetting external RTL8218FB phy.
  This should be specified as "reset-gpios" property in MDIO node, but
  RTL8218FB won't be configured on RTL8218D support in the phy driver.
  So, ethernet ports on the phy will be broken after hard-resetting.
  At the moment, configure this pin as gpio-hog to avoid breaking by
  resetting.

Back to the stock firmware:

1. Delete "loadaddr" variable and set "bootcmd" to the original value

   on U-Boot:

     setenv loadaddr
     setenv bootcmd 'bootm 0x81000000'

   on OpenWrt:

     fw_setenv loadaddr
     fw_setenv bootcmd 'bootm 0x81000000'

2. Perform reset or reboot

  on U-Boot:

    reset

  on OpenWrt:

    reboot

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-08-06 14:39:57 +02:00
Christian Lamparter
d6801e0d3f kernel: silence refresh warning
|Warning: trailing whitespace in line 66 of drivers/mtd/parsers/Kconfig

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-08-05 14:10:42 +02:00
Daniel Kestrel
8756a04787 lantiq: fix lan port 3+4 phy-mode settings for Fritzbox 3390
There are forum reports that 2 LAN ports are still not working,
the phy-mode settings are adjusted to fix the problem.

Fixes: #10371
Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
2022-08-05 14:10:42 +02:00
Olliver Schinagl
943905b0b6 realtek: Fix typo in Kconfig prompt
As the symbol RTL930x shows, the bool enables the RTL930x platform, not
the RTL839x one.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
(slightly changed commit subject)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-08-05 14:10:42 +02:00
Leo Soares
35a0f2b00c ath79: add LTE led for GL.iNet GL-XE300
This commit adds the LTE led for GL.iNet GL-XE300
to the default leds config.

Signed-off-by: Leo Soares <leo@hyper.ag>
2022-08-05 14:10:42 +02:00
Paul Spooren
8019410f56 x86: add missing Lex 3I380NX network detection
The Lex 3I380NX industrial PC has 4 ethernet controllers on board
which need pmc_plt_clk0 - 3 to function, add it to the critclk_systems
DMI table, so that drivers/clk/x86/clk-pmc-atom.c will mark the clocks
as CLK_CRITICAL and they will not get turned off.

This commit is nearly redundant to 3d0818f5eba8 ("platform/x86:
pmc_atom: Add Lex 3I380D industrial PC to critclk_systems DMI table")
but for all Lex Baytrail devices.

The original vendor firmware is only available using the WaybackMachine:
http://www.lex.com.tw/products/3I380NX.html

Signed-off-by: Michael Schöne <michael.schoene@rhebo.com>
Signed-off-by: Paul Spooren <paul.spooren@rhebo.com>
(Hans broader version for more Lex Baytrail systems, v5.15)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-08-05 14:10:11 +02:00
Shiji Yang
1330816178 ramips: add support for H3C TX1800 Plus / TX1801 Plus / TX1806
H3C TX180x series WiFi6 routers are customized by different carrier.
While these three devices look different, they use the same motherboard
inside. Another minor difference comes from the model name definition
in the u-boot environment variable.

Specifications:
 SOC:      MT7621 + MT7915
 ROM:      128 MiB
 RAM:      256 MiB
 LED:      status *2
 Button:   reset *1 + wps/mesh *1
 Ethernet:        lan *3 + wan *1 (10/100/1000Mbps)
 TTL Baudrate:    115200
 TFTP server IP:  192.168.124.99

MAC Address:
 use        address(sample 1)   address(sample 2)    source
 label      88:xx:xx:98:xx:12   88:xx:xx:a2:xx:a5   u-boot-env@ethaddr
 lan        88:xx:xx:98:xx:13   88:xx:xx:a2:xx:a6   $label +1
 wan        88:xx:xx:98:xx:12   88:xx:xx:a2:xx:a5   $label
 WiFi4_2G   8a:xx:xx:58:xx:14   8a:xx:xx:52:xx:a7   (Compatibility mode)
 WiFi5_5G   8a:xx:xx:b8:xx:14   8a:xx:xx:b2:xx:a7   (Compatibility mode)
 WiFi6_2G   8a:xx:xx:18:xx:14   8a:xx:xx:12:xx:a7
 WiFi6_5G   8a:xx:xx:78:xx:14   8a:xx:xx:72:xx:a7

Compatibility mode is used to guarantee the connection of old devices
that only support WiFi4 or WiFi5.

TFTP + TTL Installation:
Although a TTL connection is required for installation, we do not need
to tear down it. We can find the TTL port from the cooling hole at the
bottom. It is located below LAN3 and the pins are defined as follows:
|LAN1|LAN2|LAN3|----|WAN|
--------------------
    |GND|TX|RX|VCC|

1. Set tftp server IP to 192.168.124.99 and put initramfs firmware in
   server's root directory, rename it to a simple name "initramfs.bin".
2. Plug in the power supply and wait for power on, connect the TTL cable
   and open a TTL session, enter "reboot", then enter "Y" to confirm.
   Finally push "0" to interruput boot while booting.
3. Execute command to install a initramfs system:
   # tftp 0x80010000 192.168.124.99:initramfs.bin
   # bootm 0x80010000
4. Backup nand flash by OpenWrt LuCI or dd instruction. We need those
   partitions if we want to back to stock firmwre due to official
   website does not provide download link.
   # dd if=/dev/mtd1 of=/tmp/u-boot-env.bin
   # dd if=/dev/mtd4 of=/tmp/firmware.bin
5. Edit u-boot env to ensure use default bootargs and first image slot:
   # fw_setenv bootargs
   # fw_setenv bootflag 0
6. Upgrade sysupgrade firmware.
7. About restore stock firmware: flash the "firmware" and "u-boot-env"
   partitions that we backed up in step 4.
   # mtd write /tmp/u-boot-env.bin u-boot-env
   # mtd write /tmp/firmware.bin firmware

Additional Info:
The H3C stock firmware has a 160-byte firmware header that appears to
use a non-standard CRC32 verification algorithm. For this part of the
data, the u-boot does not check it so we can just directly replace it
with a placeholder.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2022-07-31 19:23:24 +02:00