Commit Graph

1065 Commits

Author SHA1 Message Date
Daniel Golle 025c0bcd60 uboot-mediatek: fix board name of Bananapi BPi-R2
As the board name was changed to be identical to the device tree
compatible string (just like for other boards), also reflect that
change for U-Boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 17:01:02 +01:00
Daniel Golle 6b2000b6ff uboot-envtools: add configuration for Bananapi BPi-R2
Add fw_env configuration for the BPi-R2 which is a mediatek/mt7623
devboard which can be booted from SD Card or eMMC.
Auto detect the boot device and add environment accordingly.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 04:11:05 +01:00
Daniel Golle a71fa5e476 uboot-envtools: move mediatek to mediatek_mt7622
All mediatek boards having fw_env accessible through uboot-envtools
belong to be mt7622 subtarget. Move the file, as subtarget-specific
files are supported for a while now.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 04:11:05 +01:00
Daniel Golle ec3bd5e197 uboot-mediatek: rework support for the BPi-R2
* use built-in default environment instead of file in bootfs
 * get rid of bootfs alltogether and use uImage.FIT
 * auto-detect boot device like original script did
 * add support for factory button

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-20 04:11:05 +01:00
Daniel Golle 349e2b7e65
uboot-mediatek: several fixes for MT7622
* ! Behavior change !

   Old behavior: If the Reset button is held down during power-on
   do factory reset and try booting recovery from TFTP forever.
   If valid recovery is received via TFTP, write it to flash and boot.

   New behavior: If the Reset button is held down during power-on
   do factory reset, then try TFTP *once*, then try booting on-flash
   recovery, then keep trying via TFTP forever until a valid image is
   received.
   Only if there is no bootable recovery stored on flash, store the
   downloaded recovery. Then boot it.

 * Set loadaddr to 0x48000000 in order to allow booting images larger
   than ~47MB (reported by Oskari Lemmelä). Setting loadaddr to
   0x48000000 gives us 384MB on devices with 512MB RAM, which should be
   more than enough as a maximum size for uImage.FIT to be loaded.

 * Widely unify device-specific default environment in preparation to
   auto-generate it from parameters.

 * backport upstream commit fixing MBR/DOS partitioning

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-11 23:39:18 +01:00
Tee Hao Wei 0c721434ea ramips: add support for Linksys EA8100 v2
Specifications:
- SoC: MT7621AT
- RAM: 256MB
- Flash: 128MB NAND
- Ethernet: 5 Gigabit ports
- WiFi: 2.4G/5G MT7615N
- USB: 1 USB 3.0, 1 USB 2.0

This device is very similar to the EA7300 v1/v2, EA7500 v2, and EA8100 v1.

Installation:

Upload the generated factory image through the factory web interface.

(following part taken from EA7300 v2 commit message:)

This might fail due to the A/B nature of this device. When flashing, OEM
firmware writes over the non-booted partition. If booted from 'A',
flashing over 'B' won't work. To get around this, you should flash the
OEM image over itself. This will then boot the router from 'B' and
allow you to flash OpenWRT without problems.

Reverting to factory firmware:

Hard-reset the router three times to force it to boot from 'B.' This is
where the stock firmware resides. To remove any traces of OpenWRT from
your router simply flash the OEM image at this point.

With thanks to Tom Wizetek (@wizetek) for testing.

Signed-off-by: Tee Hao Wei <angelsl@in04.sg>
2021-07-11 16:58:12 +02:00
Dirk Neukirchen 2c9537e274 grub2: update to 2.06
-300-CVE-2015-8370.patch is upstreamed with different code
(upstream id: 451d80e52d851432e109771bb8febafca7a5f1f2)

- fixup OpenWrts setup_root patch

compile tested: x86_64,i386
runtime tested: VM x86_64,VM i386

- booted fine
- grub-editenv worked

Signed-off-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
2021-06-21 09:02:26 -10:00
李国 e4723755f2 grub2: pass compilation parameters more accurately
In order for the grub2 boot-related code to compile normally, we have
made many adjustments to the compilation parameters. These adjustments
are not necessary for tools-related code. We apply these parameter
adjustments only to the boot-related code.

Signed-off-by: 李国 <uxgood.org@gmail.com>
2021-06-20 13:34:27 -10:00
李国 ca94104136 grub2: make grub2 tools built in a separate variant
grub2 boot-related code and tools-related code may require different
compilation parameters. We split them into different variants for
compilation, so that we can accurately pass the required parameters and
avoid causing problems.

Signed-off-by: 李国 <uxgood.org@gmail.com>
2021-06-20 13:31:09 -10:00
李国 5876d6a62f grub2: make grub2-bios-setup as a separate package
The grub2 and grub2-efi packages should only contain boot-related code.
grub-bios-setup is the same as grub-editenv, they are both grub2 tools
and should be placed in a separate package.

Signed-off-by: 李国 <uxgood.org@gmail.com>
[use AUTORELEASE and update to SPDX]
Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-06-20 13:23:42 -10:00
Tianling Shen 52dc7995f7 uboot-rockchip: add NanoPi R4S support
Add support for the FriendlyARM NanoPi R4S.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2021-06-10 10:34:44 +02:00
Adrian Schmutzler 482e65a16d uboot-kirkwood: refresh patches
This is only cosmetic, but the next one adding a patch here would
have to do it anyway, and thus will get a smaller diff for review
now.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-06-06 19:06:29 +02:00
BERENYI Balazs 03d66d6b8f kirkwood: Add support for Sheevaplug
Globalscale SheevaPlug:
* Marvell Kirkwood 88F6281
* 512 MB SDRAM
* 512 MB Flash
* Gigabit Network
* USB 2.0
* SD slot
* Serial console

The device is supported in mainline uboot/linux the commit adds only
some openwrt config for building an image.

Installation:
1 - Update uboot:
setenv ipaddr '192.168.0.111'
setenv serverip '192.168.0.1'
tftpboot u-boot.kwb
nand erase 0x0 0x100000
nand write 0x800000 0x0 0x100000
reset
2 - Install OpenWRT:
setenv ethaddr 00:50:43:01:xx:xx
saveenv
setenv ipaddr '192.168.0.111'
setenv serverip '192.168.0.1'
tftpboot openwrt-kirkwood-globalscale_sheevaplug-squashfs-factory.bin
nand erase.part ubi
nand write 0x800000 ubi 0x600000
reset

Signed-off-by: BERENYI Balazs <balazs@wee.hu>
Reviewed-by: Pawel Dembicki <paweldembicki@gmail.com>
[add vendor name for uboot-kirkwood, merge patches, copy to 5.10,
add AUTORELEASE for uboot-kirkwood, refresh patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-06-06 19:05:07 +02:00
Lauro Moreno da8428d277 ipq806x: add support for Askey RT4230W REV6
This adds support for the Askey RT4230W REV6
(Branded by Spectrum/Charter as RAC2V1K)

At this time, there's no way to reinstall the stock firmware so don't install
this on a router that's being rented.

Specifications:

    Qualcomm IPQ8065
    1 GB of RAM (DDR3)
    512 MB Flash (NAND)
    2x Wave 2 WiFi cards (QCA9984)
    5x 10/100/1000 Mbps Ethernet (Switch: QCA8337)
    1x LED (Controlled by a microcontroller that switches it between red and
        blue with different patterns)
    1x USB 3.0 Type-A
    12V DC Power Input
    UART header on PCB - pinout from top to bottom is RX, TX, GND, 5V
    Port settings are 115200n8

More information: https://forum.openwrt.org/t/askey-rac2v1k-support/15830
https://deviwiki.com/wiki/Askey_RAC2V1K

To check what revision your router is, restore one of these config backups
through the stock firmware to get ssh access then run
"cat /proc/device-tree/model".
https://forum.openwrt.org/t/askey-rac2v1k-support/15830/17
The revision number on the board doesn't seem to be very consistent so that's
why this is needed. You can also run printenv in the uboot console and if
machid is set to 177d, that means your router is rev6.

Note: Don't install this if the router is being rented from an ISP. The defined
partition layout is different from the OEM one and even if you changed the
layout to match, backing up and restoring the OEM firmware breaks /overlay so
nothing will save and the router will likely enter a bootloop.

How to install:

Method 1: Install without opening the case using SSH and tftp

    You'll need:
    RAC2V1K-SSH.zip:
https://github.com/lmore377/openwrt-rt4230w/blob/master/RAC2V1K-SSH.zip
    initramfs and sysupgrade images

    Connect to one of the router's LAN ports

    Download the RAC2V1K-SSH.zip file and restore the config file that
corresponds to your router's firmware (If you're firmware is newer than what's
in the zip file, just restore the 1.1.16 file)

    After a reboot, you should be able to ssh into the router with username:
"4230w" and password: "linuxbox" or "admin". Run the following commannds
     fw_setenv ipaddr 10.42.0.10 #IP of router, can be anything as long as
it's in the same subnet as the server
     fw_setenv serverip 10.42.0.1# #IP of tftp server that's set up in next
steps
     fw_setenv bootdelay 8
     fw_setenv bootcmd "tftpboot initramfs.bin; bootm; bootipq"

    Don't reboot the router yet.

    Install and set up a tftp server on your computer

    Set a static ip on the ethernet interface of your computer (use this for
serverip in the above commands)

    Rename the initramfs image to initramfs.bin, and host it with the tftp
server

    Reboot the router. If you set up everything right, the router led should
switch over to a slow blue glow which means openwrt is booted. If for some
reason the file doesn't get loaded into ram properly, it should still boot to
the OEM firmware.
    After openwrt boots, ssh into it and run these commands:
    fw_setenv bootcmd "setenv mtdids nand0=nand0 && setenv mtdparts
 mtdparts=nand0:0x1A000000@0x2400000(firmware) && ubi part firmware && ubi
read 0x44000000 kernel 0x6e0000 && bootm"
    fw_setenv bootdelay 2

    After openwrt boots up, figure out a way to get the sysupgrade file onto it
(scp, custom build with usb kernel module included, wget, etc.) then flash it
with sysupgrade. After it finishes flashing, it should reboot, the light should
start flashing blue, then when the light starts "breathing" blue that means
openwrt is booted.

Method 2: Install with serial access (Do this if something fails and you can't
boot after using method 1)

    You'll need:
    initramfs and sysupgrade images
    Serial access:
https://openwrt.org/inbox/toh/askey/askey_rt4230w_rev6#opening_the_case

    Install and set up a tftp server

    Set a static ip on the ethernet interface of your computer

    Download the initramfs image, rename it to initramfs.bin, and host it with
the tftp server

    Connect the wan port of the router to your computer

    Interrupt U-Boot and run these commands:
    setenv serverip 10.42.0.1 (You can use whatever ip you set for the computer)
    setenv ipaddr 10.42.0.10 (Can be any ip as long as it's in the same subnet)
    setenv bootcmd "setenv mtdids nand0=nand0 &&
set mtdparts mtdparts=nand0:0x1A000000@0x2400000(firmware) && ubi part firmware
&& ubi read 0x44000000 kernel 0x6e0000 && bootm"

    saveenv
    tftpboot initramfs.bin
    bootm

    After openwrt boots up, figure out a way to get the sysupgrade file onto it
(scp, custom build with usb kernel module included, wget, etc.) then flash it
with sysupgrade. After it finishes flashing, it should reboot, the light should
start flashing blue, then when the light starts "breathing" blue that means
openwrt is booted.

Signed-off-by: Lauro Moreno <lmore377@gmail.com>
[add entry in 5.10 patch, fix whitespace issues]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-06-05 23:39:14 +02:00
Tee Hao Wei b232680f84 ramips: add support for Linksys EA8100 v1
Specifications:
- SoC: MT7621AT
- RAM: 256MB
- Flash: 128MB NAND
- Ethernet: 5 Gigabit ports
- WiFi: 2.4G/5G MT7615N
- USB: 1 USB 3.0, 1 USB 2.0

This device is very similar to the EA7300 v1/v2 and EA7500 v2.

Installation:

Upload the generated factory image through the factory web interface.

(following part taken from EA7300 v2 commit message:)

This might fail due to the A/B nature of this device. When flashing, OEM
firmware writes over the non-booted partition. If booted from 'A',
flashing over 'B' won't work. To get around this, you should flash the
OEM image over itself. This will then boot the router from 'B' and
allow you to flash OpenWRT without problems.

Reverting to factory firmware:

Hard-reset the router three times to force it to boot from 'B.' This is
where the stock firmware resides. To remove any traces of OpenWRT from
your router simply flash the OEM image at this point.

With thanks to Leon Poon (@LeonPoon) for the initial bringup.

Signed-off-by: Tee Hao Wei <angelsl@in04.sg>
[add missing entry in 10_fix_wifi_mac]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-06-05 23:39:14 +02:00
Jonathan Sturges 6d23e474ad ramips: add support for Amped Wireless ALLY router and extender
Amped Wireless ALLY is a whole-home WiFi kit, with a router (model
ALLY-R1900K) and an Extender (model ALLY-00X19K).  Both are devices are
11ac and based on MediaTek MT7621AT and MT7615N chips.  The units are
nearly identical, except the Extender lacks a USB port and has a single
Ethernet port.

Specification:
- SoC: MediaTek MT7621AT (2C/4T) @ 880MHz
- RAM: 128MB DDR3 (Nanya NT5CC64M16GP-DI)
- FLASH: 128MB NAND (Winbond W29N01GVSIAA)
- WiFi: 2.4/5 GHz 4T4R
  - 2.4GHz MediaTek MT7615N bgn
  - 5GHz MediaTek MT7615N nac
- Switch: SoC integrated Gigabit Switch
- USB: 1x USB3 (Router only)
- BTN: Reset, WPS
- LED: single RGB
- UART:  through-hole on PCB.
   J1: pin1 (square pad, towards rear)=3.3V, pin2=RX,
   pin3=GND, pin4=TX.  Settings: 57600/8N1.

Note regarding dual system partitions
-------------------------------------

The vendor firmware and boot loader use a dual partition scheme.  The boot
partition is decided by the bootImage U-boot environment variable: 0 for
the 1st partition, 1 for the 2nd.

OpenWrt does not support this scheme and will always use the first OS
partition.  It will set bootImage to 0 during installation, making sure
the first partition is selected by the boot loader.

Also, because we can't be sure which partition is active to begin with, a
2-step flash process is used.  We first flash an initramfs image, then
follow with a regular sysupgrade.

Installation:

Router (ALLY-R1900K)
1) Install the flashable initramfs image via the OEM web-interface.
  (Alternatively, you can use the TFTP recovery method below.)
  You can use WiFi or Ethernet.
  The direct URL is:  http://192.168.3.1/07_06_00_firmware.html
  a. No login is needed, and you'll be in their setup wizard.
  b. You might get a warning about not being connected to the Internet.
  c. Towards the bottom of the page will be a section entitled "Or
  Manually Upgrade Firmware from a File:" where you can manually choose
  and upload a firmware file.
  d: Click "Choose File", select the OpenWRT "initramfs" image and click
  "Upload."
2) The Router will flash the OpenWrt initramfs image and reboot.  After
  booting, LuCI will be available on 192.168.1.1.
3) Log into LuCI as root; there is no password.
4) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
5) Complete the Installation by flashing a full OpenWRT image.  Note:
  you may use the sysupgrade command line tool in lieu of the UI if
  you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Extender (ALLY-00X19K)
1) This device requires a TFTP recovery procedure to do an initial load
  of OpenWRT.  Start by configuring a computer as a TFTP client:
  a. Install a TFTP client (server not necessary)
  b. Configure an Ethernet interface to 192.168.1.x/24; don't use .1 or .6
  c. Connect the Ethernet to the sole Ethernet port on the X19K.
2) Put the ALLY Extender in TFTP recovery mode.
  a. Do this by pressing and holding the reset button on the bottom while
  connecting the power.
  b. As soon as the LED lights up green (roughly 2-3 seconds), release
  the button.
3) Start the TFTP transfer of the Initramfs image from your setup machine.
For example, from Linux:
tftp -v -m binary 192.168.1.6 69 -c put initramfs.bin
4) The Extender will flash the OpenWrt initramfs image and reboot.  After
booting, LuCI will be available on 192.168.1.1.
5) Log into LuCI as root; there is no password.
6) Optional (but recommended) is to backup the OEM firmware before
  continuing; see process below.
7) Complete the Installation by flashing a full OpenWRT image.  Note: you
may use the sysupgrade command line tool in lieu of the UI if you prefer.
  a.  Choose System -> Backup/Flash Firmware.
  b.  Click "Flash Image..." under "Flash new firmware image"
  c.  Click "Browse..." and then select the sysupgrade file.
  d.  Click Upload to upload the sysupgrade file.
  e.  Important:  uncheck "Keep settings and retain the current
      configuration" for this initial installation.
  f.  Click "Continue" to flash the firmware.
  g.  The device will reboot and OpenWRT is installed.

Backup the OEM Firmware:
-----------------------

There isn't any downloadable firmware for the ALLY devices on the Amped
Wireless web site. Reverting back to the OEM firmware is not possible
unless we have a backup of the original OEM firmware.

The OEM firmware may be stored on either /dev/mtd3 ("firmware") or
/dev/mtd6 ("oem").  We can't be sure which was overwritten with the
initramfs image, so backup both partitions to be safe.

  1) Once logged into LuCI, navigate to System -> Backup/Flash Firmware.
  2) Under "Save mtdblock contents," first select "firmware" and click
  "Save mtdblock" to download the image.
  3) Repeat the process, but select "oem" from the pull-down menu.

Revert to the OEM Firmware:
--------------------------
* U-boot TFTP:
  Follow the TFTP recovery steps for the Extender, and use the
  backup image.

* OpenWrt "Flash Firmware" interface:
  Upload the backup image and select "Force update"
  before continuing.

Signed-off-by: Jonathan Sturges <jsturges@redhat.com>
2021-06-05 23:39:14 +02:00
Robert Marko b126d9c3a3 ipq40xx: add netgear wac510 support
This adds support for the Netgear WAC510 Insight Managed Smart Cloud
Wireless Access Point, an indoor dual-band, dual-radio 802.11ac
business-class wireless AP with integrated omnidirectional antennae
and two 10/100/1000 Mbps Ethernet ports.

For more information see:
<https://www.netgear.com/business/wifi/access-points/wac510>

Specifications:
SoC:        Qualcomm IPQ4018 (DAKOTA) ARM Quad-Core
RAM:        256 MiB
Flash1:     2 MiB Winbond W25Q16JV SPI-NOR
Flash2:     128 MiB Winbond W25N01GVZEIG SPI-NAND
Ethernet:   Built-in IPQ4018 (SoC, QCA8072 PHY), 2x 1000/100/10 port,
            WAN port active IEEE 802.3af/at PoE in
Wireless1:  Built-in IPQ4018 (SoC) 802.11b/g/n 2x2:2, 3 dBi antennae
Wireless2:  Built-in IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 4 dBi antennae
Input:      (Optional) Barrel 12 V 2.5 A Power, Reset button SW1
LEDs:       Power, Insight, WAN PoE, LAN, 2.4G WLAN, 5G WLAN
Serial:     Header J2
1 - 3.3 Volt (Do NOT connect!)
2 - TX
3 - RX
4 - Ground
WARNING: The serial port needs a TTL/RS-232 3.3 volt level converter!
         The Serial settings are 115200-8-N-1.

Installation via Stock Web Interface:
BTW: The default factory console/web interface login user/password are
admin/password.

In the web interface navigating to Management - Maintenance - Upgrade -
'Firmware Upgrade' will show you what is currently installed e.g.:
Manage Firmware
Current Firmware Version: V5.0.10.2
Backup Firmware Version: V1.2.5.11
Under 'Upgrade Options' choose Local (alternatively SFTP would be
available) then click/select 'Browse File' on the right side, choose
openwrt-ipq40xx-generic-netgear_wac510-squashfs-nand-factory.tar
and hit the Upgrade button below. After a minute or two your browser
should indicate completion printing 'Firmware update complete.' and
'Rebooting AP...'.

Note that OpenWrt will use the WAN PoE port as actual WAN port
defaulting to DHCP client but NOT allowing LuCI access, use LAN port
defaulting to 192.168.1.1/24 to access LuCI.

Installation via TFTP Requiring Serial U-Boot Access:
Connect to the device's serial port and hit any key to stop autoboot.
Upload and boot the initramfs based OpenWrt image as follows:
(IPQ40xx) # setenv serverip 192.168.1.1
(IPQ40xx) # setenv ipaddr 192.168.1.2
(IPQ40xx) # tftpboot openwrt-ipq40xx-generic-netgear_wac510-initramfs-fit-uImage.itb
(IPQ40xx) # bootm

Note: This only runs OpenWrt from RAM and has not installed anything
to flash as of yet. One may permanently install OpenWrt as follows:

Check the MTD device number of the active partition:
root@OpenWrt:/# dmesg | grep 'set to be root filesystem'
[    1.010084] mtd: device 9 (rootfs) set to be root filesystem
Upload the factory image ending with .ubi to /tmp (e.g. using scp or
tftp). Then flash the image as follows (substituting the 9 in mtd9
below with whatever number reported above):
root@OpenWrt:/# ubiformat /dev/mtd9 -f /tmp/openwrt-ipq40xx-generic-netgear_wac510-squashfs-nand-factory.ubi
And reboot.

Dual Image Configuration:
The default U-Boot boot command bootipq uses the U-Boot environment
variables primary/secondary to decide which image to boot. E.g.
primary=0, secondary=3800000 uses rootfs while primary=3800000,
secondary=0 uses rootfs_1.
Switching their values changes the active partition. E.g. from within
U-Boot:
(IPQ40xx) # setenv primary 0
(IPQ40xx) # setenv secondary 3800000
(IPQ40xx) # saveenv
Or from a OpenWrt userspace serial/SSH console:
fw_setenv primary 0
fw_setenv secondary 3800000
Note that if you install two copies of OpenWrt then each will have its
independent configuration not like when switching partitions on the
stock firmware.
BTW: The kernel log shows which boot partition is active:
[    2.439050] ubi0: attached mtd9 (name "rootfs", size 56 MiB)
vs.
[    2.978785] ubi0: attached mtd10 (name "rootfs_1", size 56 MiB)
Note: After 3 failed boot attempts it automatically switches partition.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
[squashed netgear-tar commit into main and rename netgear-tar for
now, until it is made generic.]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2021-06-05 23:29:46 +02:00
Sven Eckelmann 9a172797e5 ath79: Add support for OpenMesh A40
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi (11n)
* 2T2R 5 GHz Wi-Fi (11ac)
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 2x ethernet
  - eth0
    + Label: Ethernet 1
    + AR8035 ethernet PHY (RGMII)
    + 10/100/1000 Mbps Ethernet
    + 802.3af POE
    + used as WAN interface
  - eth1
    + Label: Ethernet 2
    + AR8035 ethernet PHY (SGMII)
    + 10/100/1000 Mbps Ethernet
    + used as LAN interface
* 1x USB
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-06-05 01:17:11 +02:00
Sven Eckelmann eaf2e32c12 ath79: Add support for OpenMesh A60
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi (11n)
* 3T3R 5 GHz Wi-Fi (11ac)
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 2x ethernet
  - eth0
    + Label: Ethernet 1
    + AR8035 ethernet PHY (RGMII)
    + 10/100/1000 Mbps Ethernet
    + 802.3af POE
    + used as WAN interface
  - eth1
    + Label: Ethernet 2
    + AR8031 ethernet PHY (SGMII)
    + 10/100/1000 Mbps Ethernet
    + used as LAN interface
* 1x USB
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-06-05 01:17:11 +02:00
Chukun Pan 57cb387cfe ramips: add support for JCG Q20
JCG Q20 is an AX 1800M router.

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W29N01HV 128 MiB
  RAM: Winbond W632GU6NB-11 256 MiB
  WiFi: MT7915 2.4/5 GHz 2T2R
  Ethernet: 10/100/1000 Mbps x3
  LED: Status (red / blue)
  Button: Reset, WPS
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page,
  do not preserve settings.

MAC addresses map:
  0x00004 *:3e wlan2g/wlan5g
  0x3fff4 *:3c lan/label
  0x3fffa *:3c wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2021-05-26 23:10:45 +02:00
Alexander Egorenkov 42cd06f7fe kexec-tools: add patch to fix issue with appended DTB and zImage on ARM
This patch fixes a recently found problem when a zImage passed to
kexec-tools contains an appended DTB. In that case kexec boot fails because
the decompressor wrongly tries to use the non-existing appended DTB instaed
of the one passed in the register r2.

- http://lists.infradead.org/pipermail/kexec/2021-April/022353.html

Signed-off-by: Alexander Egorenkov <egorenar-dev@posteo.net>
2021-05-23 15:11:38 +02:00
Dirk Neukirchen 622f8ef577 grub2: disable liblzma dependency
Florian Ekert reported:

"I have build a fresh master branch recently, Since your last change [1]
on grub2, I have now a new dependency on liblzma for the install package
grub2-editenv.

root@st-dev-07 /usr/lib # ldd /root/grub-editenv
       /lib/ld-musl-x86_64.so.1 (0x7f684b088000)
       liblzma.so.5 => /usr/lib/liblzma.so.5 (0x7f684b06d000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7f684b059000)
       libc.so => /lib/ld-musl-x86_64.so.1 (0x7f684b088000)

This was not the case before your update.

root@st-dev-07 /usr/sbin # ldd /usr/sbin/grub-editenv
       /lib/ld-musl-x86_64.so.1 (0x7fd970176000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7fd970162000)
       libc.so => /lib/ld-musl-x86_64.so.1 (0x7fd970176000)

My build complains that it cannot satisfy the runtime package dependency
for grub2-editenv.

install -d -m0755 /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv/usr/sbin
install -m0755 /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/grub-editenv /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv/usr/sbin/
find /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package grub2-editenv is missing dependencies for the following libraries:
liblzma.so.5
make[2]: *** [Makefile:166: /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/bin/APOS/feckert/master/master-Maggie-455-ga5edc0e8e/x86_64/targets/x86/64/packages/grub2-editenv_2.06~rc1-1_x86_64.ipk] Error 1
make[2]: Leaving directory '/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/package/boot/grub2'
time: package/boot/grub2/pc/compile#78.64#9.79#83.88
   ERROR: package/boot/grub2 failed to build (build variant: pc).
make[1]: *** [package/Makefile:116: package/boot/grub2/compile] Error 1
make[1]: Leaving directory '/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt'
make: *** [/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/include/toplevel.mk:230: package/boot/grub2/compile] Error 2

If I add the following changes to the package all works as expected.

<snip>
-  DEPENDS:=@TARGET_x86
+  DEPENDS:=@TARGET_x86 +liblzma
  VARIANT:=pc
endef

This is a hotfix but I dont´t think this is the final solution, because lzma is provided by the package xz.
And This is maintained in the package feed [not the core]"

Dirk stated & offered his patch to disable liblzma and thus resolve the
'out of core dependency' problem:

"LZMA is used in mkimage.c
disabling it prints
Without liblzma (no support for XZ-compressed mips images) (explicitly disabled)
(see configure.ac)

liblzma is autodetected so this issue was present but hidden somehow

[unsure: grep/image generation does not use grub with that option]
OpenWrt does not use that feature currently

[!] some scripts and examples use --compression=xz or -C xz and those will break

grub has an internal xzlib for different "lzma" functionality
(ext. LIBLZMA from XZ (GRUB_COMPRESSION_XZ) vs. GRUB_COMPRESSION_LZMA)"

Hopefully fixes e74d81ece2 and doesn't
break anything else.

Signed-off-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
[include Florian's description of how problem 1st encountered]
[bump package release]
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-05-21 09:17:59 +01:00
Piotr Dymacz 6f3a05ebb0 uboot-envtools: support uci-default config also per subtargets
The current version of 'uboot-envtools' package generates dedicated
uci-default file only per target. This change makes it possible to
use subtarget-specific files, with name pattern: 'target_subtarget'
(example: 'ath79_nand'). The subtarget-specific files will take
precedence over target-specific one.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-05-20 13:57:43 +02:00
Piotr Dymacz fab114f6f3 uboot-imx6: update BUILD_DEVICES values
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-05-20 13:45:12 +02:00
Piotr Dymacz 959eabf172 uboot-imx6: drop 'HIDDEN' flag from 'mx6cuboxi' define
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-05-20 13:45:12 +02:00
Giulio Lorenzo b108ed0ab0 ath79: add support for ZiKing CPE46B
ZiKing CPE46B is a POE outdoor 2.4ghz device with an integrated directional
antenna. It is low cost and mostly available via Aliexpress, references can
be found at:
- https://forum.openwrt.org/t/anddear-ziking-cpe46b-ar9331-ap121/60383
- https://git.lsd.cat/g/openwrt-cpe46b

Specifications:

- Atheros AR9330
- 32MB of RAM
- 8MB of flash (SPI NOR)
- 1 * 2.4ghz integrated antenna
- 2 * 10/100/1000 ethernet ports (1 POE)
- 3 * Green LEDs controlled by the SoC
- 3 * Green LEDs controlled via GPIO
- 1 * Reset Button controlled via GPIO
- 1 * 4 pin serial header on the PCB
- Outdoor packaging

Flashing instruction:

You can use sysupgrade image directly in vendor firmware which is based
on OpenWrt/LEDE. In case of issues with the vendor GUI, the vendor
Telnet console is vulnerable to command injection and can be used to gain
a shell directly on the OEM OpenWrt distribution.

Signed-off-by: Giulio Lorenzo <salveenee@mortemale.org>
[fix whitespaces, drop redundant uart status and serial0, drop
num-chipselects, drop 0x1002 MAC address for wmac]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-05-17 01:01:32 +02:00
Stijn Tintel e74d81ece2 grub2: bump to 2.06-rc1
When building GRUB with binutils 2.35.2 or later, an error occurs due to
a section .note.gnu.property that is placed at an offset such that
objcopy needs to pad the img file with zeros. This in turn causes the
following error: "error: Decompressor is too big.".

The fix accepted by upstream patches a python script that isn't executed
at all when building GRUB with OpenWrt buildroot. There's another patch
that patches the files generated by that python script directly, but by
including it we would deviate further from upstream. Instead of doing
that, simply bump to the latest release candidate.

As one of the fixes for the CVEs causes grub to crash on some x86
hardware using legacy BIOS when compiled with -O2, filter -O2 and
-O3 out of TARGET_CFLAGS.

Fixes the following CVEs:
- CVE-2020-14372
- CVE-2020-25632
- CVE-2020-25647
- CVE-2020-27749
- CVE-2020-27779
- CVE-2021-3418
- CVE-2021-20225
- CVE-2021-20233

Runtime-tested on x86/64.

Fixes: FS#3790

Suggested-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-05-16 04:00:29 +03:00
Bjørn Mork 2449a63208 ramips: mt7621: Add support for ZyXEL NR7101
The ZyXEL NR7101 is an 802.3at PoE powered 5G outdoor (IP68) CPE
with integrated directional 5G/LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7603E
 - Switch: 1 LAN port (Gigabiti)
 - 5G/LTE: Quectel RG502Q-EA connected by USB3 to SoC
 - SIM: 2 micro-SIM slots under transparent cover
 - Buttons: Reset, WLAN under same cover
 - LEDs: Multicolour green/red/yellow under same cover (visible)
 - Power: 802.3at PoE via LAN port

The device is built as an outdoor ethernet to 5G/LTE bridge or
router. The Wifi interface is intended for installation and/or
temporary management purposes only.

UART Serial:

57600N1
Located on populated 5 pin header J5:

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

Remove the SIM/button/LED cover, the WLAN button and 12 screws
holding the back plate and antenna cover together. The GPS antenna
is fixed to the cover, so be careful with the cable.  Remove 4
screws fixing the antenna board to the main board, again being
careful with the cables.

A bluetooth TTL adapter is recommended for permanent console
access, to keep the router water and dustproof. The 3.3V pin is
able to power such an adapter.

MAC addresses:

OpenWrt OEM   Address          Found as
lan     eth2  08:26:97:*:*:BC  Factory 0xe000 (hex), label
wlan0   ra0   08:26:97:*:*:BD  Factory 0x4 (hex)
wwan0   usb0  random

WARNING!!

ISP managed firmware might at any time update itself to a version
where all known workarounds have been disabled.  Never boot an ISP
managed firmware with a SIM in any of the slots if you intend to use
the router with OpenWrt. The bootloader lock can only be disabled with
root access to running firmware. The flash chip is physically
inaccessible without soldering.

Installation from OEM web GUI:

- Log in as "supervisor" on https://172.17.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
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Installation from OEM ssh:

- Log in as "root" on 172.17.1.1 port 22022
- scp OpenWrt initramfs-recovery.bin image to 172.17.1.1:/tmp
- Prepare bootloader config by running:
    nvram setro uboot DebugFlag 0x1
    nvram setro uboot CheckBypass 0
    nvram commit
- Run "mtd_write -w write initramfs-recovery.bin Kernel" and reboot
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Copying OpenWrt to the recovery partition:

- Verify that you are running a working OpenWrt recovery image
  from flash
- ssh to root@192.168.1.1 and run:
    fw_setenv CheckBypass 0
    mtd -r erase Kernel2
- Wait while the bootloader mirrors Image1 to Image2

NOTE: This should only be done after successfully booting the OpenWrt
  recovery image from the primary partition during installation.  Do
  not do this after having sysupgraded OpenWrt!  Reinstalling the
  recovery image on normal upgrades is not required or recommended.

Installation from Z-Loader:

- Halt boot by pressing Escape on console
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Type "ATNR 1,initramfs-recovery.bin" at the "ZLB>" prompt
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- Sysupgrade to the OpenWrt sysupgrade image

NOTE: ATNR will write the recovery image to both primary and recovery
  partitions in one go.

Booting from RAM:

- Halt boot by pressing Escape on console
- Type "ATGU" at the "ZLB>" prompt to enter the U-Boot menu
- Press "4" to select "4: Entr boot command line interface."
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Load it using "tftpboot 0x88000000 initramfs-recovery.bin"
- Boot with "bootm  0x8800017C" to skip the 380 (0x17C) bytes ZyXEL
  header

This method can also be used to RAM boot OEM firmware. The warning
regarding OEM applies!  Never boot an unknown OEM firmware, or any OEM
firmware with a SIM in any slot.

NOTE: U-Boot configuration is incomplete (on some devices?). You may
  have to configure a working mac address before running tftp using
   "setenv eth0addr <mac>"

Unlocking the bootloader:

If you are unebale to halt boot, then the bootloader is locked.

The OEM firmware locks the bootloader on every boot by setting
DebugFlag to 0.  Setting it to 1 is therefore only temporary
when OEM firmware is installed.

- Run "nvram setro uboot DebugFlag 0x1; nvram commit" in OEM firmware
- Run "fw_setenv DebugFlag 0x1" in OpenWrt

  NOTE:
    OpenWrt does this automatically on first boot if necessary

  NOTE2:
    Setting the flag to 0x1 avoids the reset to 0 in known OEM
    versions, but this might change.

  WARNING:
    Writing anything to flash while the bootloader is locked is
    considered extremely risky. Errors might cause a permanent
    brick!

Enabling management access from LAN:

Temporary workaround to allow installing OpenWrt if OEM firmware
has disabled LAN management:

- Connect to console
- Log in as "root"
- Run "iptables -I INPUT -i br0 -j ACCEPT"

Notes on the OEM/bootloader dual partition scheme

The dual partition scheme on this device uses Image2 as a recovery
image only. The device will always boot from Image1, but the
bootloader might copy Image2 to Image1 under specific conditions. This
scheme prevents repurposing of the space occupied by Image2 in any
useful way.

Validation of primary and recovery images is controlled by the
variables CheckBypass, Image1Stable, and Image1Try.

The bootloader sets CheckBypass to 0 and reboots if Image1 fails
validation.

If CheckBypass is 0 and Image1 is invalid then Image2 is copied to
Image1.

If CheckBypass is 0 and Image2 is invalid, then Image1 is copied to
Image2.

If CheckBypass is 1 then all tests are skipped and Image1 is booted
unconditionally.  CheckBypass is set to 1 after each successful
validation of Image1.

Image1Try is incremented if Image1Stable is 0, and Image2 is copied to
Image1 if Image1Try is 3 or larger.  But the bootloader only tests
Image1Try if CheckBypass is 0, which is impossible unless the booted
image sets it to 0 before failing.

The system is therefore not resilient against runtime errors like
failure to mount the rootfs, unless the kernel image sets CheckBypass
to 0 before failing. This is not yet implemented in OpenWrt.

Setting Image1Stable to 1 prevents the bootloader from updating
Image1Try on every boot, saving unnecessary writes to the environment
partition.

Keeping an OpenWrt initramfs recovery as Image2 is recommended
primarily to avoid unwanted OEM firmware boots on failure. Ref the
warning above. It enables console-less recovery in case of some
failures to boot from Image1.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-05-09 09:15:44 +02:00
Daniel Golle cc201759b6
uboot-mediaktek: add support for PSTORE and check it on boot
Add support for pstore/ramoops now that DRAM content is preserved
over reboot on MT7622. On each boot, check pstore and boot to recovery
image in case there are records stored in it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-08 23:35:38 +01:00
Daniel Golle c91c0c1f85
arm-trusted-firmware-mediatek: update to git HEAD
Most notably this enabled use of pstore/ramoops on MT7622 as DRAM
content is now preserved over reboot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-08 23:27:38 +01:00
Daniel Golle f990bddf6f
uboot-envtools: change size for unifi-6-lr
The previous commit increased the U-Boot environment size of the
UniFi 6 LR to 0x4000. Also change it uboot-envtools accordingly.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-07 22:50:22 +01:00
Daniel Golle af3a1adee0
uboot-mediatek: unifi-6-lr: fix erase of production parition
mtd erase needs to be aligned with erase blocks. Use padded image size
for erasing the production volume.
As the environment grew above the current size of 0x1000 bytes by
introducing the new padding function, increase the env size to 0x4000.
While at it, clean up reset button function to work to more reliable on
that board.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-07 22:50:15 +01:00
Daniel Golle fbcfa895a8
uboot-mediatek: bpi-r64: add TFTP update options to eMMC bootmenu
Just like on SPI-NAND, also allow updating the bootloader comfortably
on eMMC installations.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-01 22:55:22 +01:00
Mauri Sandberg addf47a9a8 uboot-envtools: add support for Buffalo WZR-HP-G300NH
This adds an entries for wzr-hp-g300nh-rb and wzr-hp-g300nh-s.

Signed-off-by: Mauri Sandberg <sandberg@mailfence.com>
2021-04-30 23:51:23 +02:00
Chen Minqiang 43dad22025
uboot-mediatek: unifi6lr: mtd erase before write to flash
Erase firmware ereas before writing to recovery or production partition
when updating them via the bootloader menu.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-28 20:54:43 +01:00
Daniel Golle ebed523ee8
arm-trusted-firmware-mediatek: fix boot hang on unifi-6-lr
The Ubiquiti Networks UniFi 6 LR access point comes with a total of
512 MB RAM provided by 2x 8-bit DDR3 SDRAM. This combination lead to
problems with the DDR calibration on boot resulting in occasional hang
on boot. Use updated calibration binary provided by MediaTek to make
boot on that device more reliable.
The binary has also been tested on the BananaPi BPi-R64 board and that
also works just fine with the new binary.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-28 20:51:53 +01:00
David Bauer b832ebb886 uboot-rockchip: update to v2021.04
Update the uboot-rockchip to the latest upstream release.
Remove upstreamed patches.

Tested-on: FriendlyElec NanoPi R2S

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-04-20 13:15:45 +02:00
Daniel González Cabanelas 4f8da19572 uboot-envtools: mvebu: add Buffalo LS421DE
The Buffalo Linkstation LS421DE NAS lacks an uboot env config file.

Create it via scripts.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
2021-04-17 22:44:09 +01:00
Zoltan HERPAI d6cf997bd7 uboot-sunxi: update ATF dependencies for 3 boards
Fix 3 board definitions that were missed in the process of moving
to the a64/h6 ATF blobs.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-15 00:24:50 +02:00
Zoltan HERPAI 9aa66b8ce7 sunxi: add support for Banana Pi M2 Berry
CPU: Allwinner V40 quad-core Cortex A7 @ 1.2GHz
Memory: 1GB DDR3
Storage: SDcard, native SATA
Network: 10/100/1000M ethernet, Ampak AP6212 wifi + BT
USB: 4x USB 2.0

Installation:
Use the standard sunxi installation to an SD-card.

While the board is very similar to the M2 Ultra board
(the V40 is the automotive version of the R40), as both
the u-boot and kernel supports them separately, and some
pins are different, let's add a separate device spec.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-12 14:02:02 +02:00
Daniel Golle d0adc4865c
uboot-mediatek: minor fixes for bpi-r64 spi-nand default env
* check image checksums before writing to flash
 * only bootmenu_0...9 are working, remove bootmenu_a entry

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-11 22:48:36 +01:00
Zoltan HERPAI 3225241c2b sunxi: add support for H6 boards and OrangePiOnePlus
Specifications:

SoC	Allwinner H6 @ 1.8 Ghz
DRAM	1Gb LPDDR3
Power	DC 5V @ 3A
Video	HDMI (Type 2.0A - full)
Audio	HDMI, on-board microphone
Network	10/100/1000Mbps Ethernet (Realtek RTL8211)
Storage	microSD
USB	1 USB2.0 Host, 1 USB2.0 OTG
Debug	Serial UART

Flashing instructions:
 Standard sunxi SD card installation procedure - copy image to SD card,
 insert into SD card slot on the device and boot.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-11 23:14:55 +02:00
Zoltan HERPAI c2163530db arm-trusted-firmware-sunxi: move to use the common tf-a build code and bump to latest version
Create a -a64 package for now. Moving to the latest ATF was tested on a
SoPine A64 board.

U-Boot SPL 2020.04 (Feb 19 2021 - 11:28:19 +0000)
DRAM: 2048 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.4(release):reboot-15854-g42b39a13d2
NOTICE:  BL31: Built : 22:45:53, Feb 22 2021
NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
NOTICE:  BL31: Found U-Boot DTB at 0x4090a28, model: SoPine with baseboard
NOTICE:  PSCI: System suspend is unavailable

U-Boot 2020.04 (Feb 19 2021 - 11:28:19 +0000) Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: SoPine with baseboard
DRAM:  2 GiB

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-11 23:14:54 +02:00
Zoltan HERPAI c75d441f20 uboot-sunxi: add ATF variable for specifying which flavour to use
In preparation for H6 support (which requires a separate ATF blob), add
an envvar to the A64 boards specifying which ATF blob to use.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2021-04-11 23:14:52 +02:00
Daniel Golle dcdafbfc1a
uboot-envtools: support environment in spi-nand on bpi-r64
Default to U-Boot env in UBI if root device is not mmc block device.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 20:19:49 +01:00
Daniel Golle 987562bad2
uboot-mediatek: add spi-nand build for bananapi bpi-r64
Some of bpi-r64 boards have serial NAND attached to SPI bus.
Build U-Boot for booting from SPI-NAND.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 20:19:34 +01:00
Oskari Lemmela cd7a9909d5 mediatek: fix writing bananapi bpi-r64 env
Use generic functions to get env partition.

Fixes: 7043e4334f ("mediatek: mt7622: improve sysupgrade on MMC")
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 14:55:35 +01:00
Oskari Lemmela d05051774e mediatek: bpi-r64: use separate partition for emmc bootloader
eMMC booloader is stored to separate partition.
FIP size is increased to 2MB.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
2021-04-11 14:55:35 +01:00
Piotr Dymacz 012a9aa00b uboot-envtools: oxnas: drop redundant space after case keywords
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:48 +02:00
Piotr Dymacz 7cde7d2131 uboot-envtools: layerscape: drop redundant space after case keywords
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:41 +02:00
Piotr Dymacz 6ab80b04fa uboot-envtools: ipq806x: drop redundant space after case keywords
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:32 +02:00
Piotr Dymacz 156a27eddf uboot-envtools: ipq40xx: drop redundant space after case keywords
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:27 +02:00
Piotr Dymacz 8c11597783 uboot-envtools: imx6: drop redundant space after case keywords
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:21 +02:00
Piotr Dymacz 914563e286 uboot-envtools: drop shebang from uci-defaults and lib files
These files are sourced and non-executable, a shebang is redundant.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:14 +02:00
Piotr Dymacz 8c3383799a uboot-imx6: define 'BUILD_DEVICES' for Toradex Apalis
Without 'BUILD_DEVICES' defined, the U-Boot related package won't be
automatically selected when building for Toradex Apalis device.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:09 +02:00
Piotr Dymacz 15e801041a uboot-imx6: align indent size in Makefile
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2021-04-10 15:18:04 +02:00
Piotr Dymacz e94d1db91e uboot-imx6: drop support for Nitrogen6x/SABRE devices
These devices never got officially supported in the tree thus it doesn't
make much sense to waste our infrastructure resources and keep building
dedicated U-Boot images for them.

CC: Petr Štetiar <ynezz@true.cz>
CC: Luka Perkov <luka.perkov@sartura.hr>
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Acked-by: Petr Štetiar <ynezz@true.cz>
2021-04-10 15:17:59 +02:00
Daniel Golle be41fd9489
uboot-envtools: add env settings for ubnt,unifi-6-lr-ubootmod
Add settings for fw_printenv/fw_setenv for the Ubiquiti UniFi 6 LR
when running OpenWrt's version of U-Boot. The settings should work
equally with the unmodified version, but that has not yet been
tested.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:51 +01:00
Daniel Golle e9ad412049
uboot-mediatek: add build for Ubiquiti Networks UniFi 6 LR
Add U-Boot build for the Ubiquiti Networks UniFi 6 LR access point.
This allows updating the bootchain to modern ARM Trusted Firmware 2.4
and U-Boot 2021.04 while keeping as much of the existing flash layout
as possible (u-boot-env, factory and eeprom partitions are retained),
gaining robust recovery vs. production dual-boot mechanism.
Add info for the Winbond W25Q512JV SPI NOR flash used in the device
and wait for GPIOs to settle after reset before checking for reset
button.
I2C connected LED controller is not supported yet.
Writing large amounts of data to SPI flash currently doesn't work due
to watchdog timeout causing reset before data write completes.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:46 +01:00
Daniel Golle d37aaf3ee2
arm-trusted-firmware-mediatek: increase NOR bl3 size
Use bl3 size of 0xa0000 instead of 0x80000 in NOR flash.
This results in bl3 ending at 0xc0000 which is where the legacy
bootchain typically puts U-Boot environment.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:40 +01:00
Daniel Golle 0268f76bbb
uboot-mediatek: bpi-r64: erase eMMC environment on installation
Erase U-Boot environment partition on eMMC on installation to make sure
chages are applied.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-09 16:04:20 +01:00
Bjørn Mork b7154fabf0 uboot-envtools: add wrapper scripts for alternate config
Now that we can create an alternate configuration file, add two
wrapper scripts for simple access to it using the alternate
alternate application names `fw_printsys' and `fw_setsys'.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-04-08 09:20:59 +02:00
Bjørn Mork a3e9fd7e5b uboot-envtools: add support for multiple config partitions
Most (all?) of the realtek devices have two u-boot config partitions
with a different set of variables in each. The U-Boot shell provides
two sets of apps to manipulate these:

 printenv- print environment variables
 printsys- printsys - print system information variables
 saveenv - save environment variables to persistent storage
 savesys - savesys - save system information variables to persistent storage
 setenv  - set environment variables
 setsys  - setsys  - set system information variables

Add support for multiple ubootenv configuration types, allowing
more than one configuration file.

Section names are not suitable for naming the different
configurations since each file can be the result of multiple sections
in case of backup partitions.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-04-08 09:20:59 +02:00
Daniel Golle 5e7d6d5ba4
uboot-mediatek: update to v2021.04
Remove patches merged upstream and refresh the remaining ones.
Runtime tested on
 * Bananapi BPi-R64 (eMMC and SD Card)
 * Linksys E8450 (SPI-NAND)
 * Ubiquiti UniFi 6 LR (SPI-NOR)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-05 18:57:51 +01:00
Daniel Golle 1db4681617 uboot-mediatek: bpi-r64: no longer force recovery on first-boot
Now that sdcard.gz image contains everything needed to boot straight
into production image, no longer force booting into recovery image on
first boot by removing the logic which implemented that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-04 10:51:25 +01:00
Daniel Golle 5ea7fabdb3
uboot-mediatek: adapt root= cmdline arg for bpi-r64
Adapt to FIT partition parser changes.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-31 22:54:17 +01:00
Rosen Penev 85fa8ad8af kexec-tools: update to 2.0.21
kdump was removed in 7acd257ae67b4ca94f8c23cb8bda0ee0709b9216

gdb can be used as an alternative.

Remove autoreconf. It's not needed as the configure files are already
generated.

Remove upstreamed patch.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-03-19 01:25:26 +01:00
Daniel Golle 81edc842f6
uboot-mediatek: don't rely in 'lzma' cmdline
Use 'xz --format=lzma' instead.
Fixes build for mt7629.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-18 04:19:48 +00:00
Hauke Mehrtens 0e3f6fbe10 mediatek: Fix writing U-Boot env on Buffalo WSR-2533DHP2
This fixes writing to the U-Boot environment by making the partition
writable and setting the correct flash sector size of 128K.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-17 22:39:59 +00:00
Daniel Golle a29f71c380 uboot-mediatek: fix default environment of bpi-r64 emmc
The emmc variant used the default environment of the sdmmc variant.
Fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-17 22:36:58 +00:00
Daniel Golle 41af8735d4 uboot-mediatek: bpi-r64: make use of FIT configuration selection
Allow selecting either SATA or PCIE functionality using uImage.FIT
configurations and device-tree overlays.
By default, PCIE1 is selected (as it has been before this change).
To select SATA instead, you can do this now:

fw_setenv bootconf config-mt7622-bananapi-bpi-r64-sata

and reboot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-17 19:55:38 +00:00
INAGAKI Hiroshi 74f15628dd mediatek: add support for Buffalo WSR-2533DHP2
This adds support for the Buffalo WSR-2533DHP2.

The device uses the Broadcom TRX image format with a special magic. To
be able to boot the images or load them they have to be wrapped with
different headers depending how it is loaded.

There are multiple ways to install OpenWrt on this device.
Boot ramdisk from U-Boot
----------------------------
This will load the image and not write it into the flash.

1. Stop boot menu with "space" key
2. Select "System Load Linux to SDRAM via TFTP."
3. Load this image:
   openwrt-mediatek-mt7622-buffalo_wsr-2533dhp2-initramfs-kernel.bin
4. The system boots the image

Write to flash from U-Boot
-----------------------------
This will load the image over tftp and directly write it into the flash.

1. Stop boot menu with "space" key
2. Select "System Load Linux Kernel then write to Flash via TFTP."
3. Load this image:
   openwrt-mediatek-mt7622-buffalo_wsr-2533dhp2-squashfs-factory-uboot.bin
4. The system writes this image into the flash and boots into it.

Write to flash from Web UI
-----------------------------
This will load the image over over the Web UI and write it into the flash

1. Open the Web UI
2. Go to "管理" -> "ファームウェア更新"
3. Select "ローカルファイル指定" and click "更新実行"
4. Load this image:
   openwrt-mediatek-mt7622-buffalo_wsr-2533dhp2-squashfs-factory.bin
5. The system writes this image into the flash and boots into it.

Specifications
-------------------
* SoC:       MT7622 (4x4 2.4 GHz Wifi)
* Wifi:      MT7615 (4x4 5 GHz Wifi)
* Flash:     Winbond W29N01HZ 128MB SLC NAND
* RAM        256MB
* Ethernet:  Realtek RTL8367S (5 x 1GBit/s, SoC via 2.5GBit/s)

Co-Developed-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-15 17:02:17 +01:00
Daniel Golle 8dae189c7e
uboot-mediatek: also install production image to eMMC
Make installation to eMMC more convenient on the BPi-R64 by also
copying the production image (if valid) from SD Card to eMMC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-14 22:15:47 +00:00
Daniel Golle 578c73fea3
uboot-mediatek: select matching U-Boot for board
Instead of building all U-Boot variants by default, build only those
needed by the selected board(s).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-14 22:00:05 +00:00
Hauke Mehrtens e6ba970b6e realtek: Add ZyXEL GS1900-8
The ZyXEL GS1900-8 is a 8 port switch without any PoE functionality or
SFP ports, but otherwise similar to the other GS1900 switches.

Specifications
--------------
* Device:    ZyXEL GS1900-8 v1.2
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L12835F 16 MiB
* RAM:       Nanya NT5TU128M8GE-AC 128 MiB DDR2 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* LEDs:      1 PWR LED (green, not configurable)
             1 SYS LED (green, configurable)
             8 ethernet port status LEDs (green, SoC controlled)
* Buttons:   1 on-off glide switch at the back (not configurable)
             1 reset button at the right side, behind the air-vent
               (not configurable)
             1 reset button on front panel (configurable)
* Power      12V 1A barrel connector
* UART:      1 serial header (JP2) with populated standard pin connector on
             the left side of the PCB, towards the back. Pins are labelled:
             + VCC (3.3V)
             + TX (really RX)
             + RX (really TX)
             + GND
             the labelling is done from the usb2serial connector's point of
             view, so RX/ TX are mixed up.

Serial connection parameters for both devices: 115200 8N1.

Installation
------------
Instructions are identical to those for the GS1900-10HP and GS1900-8HP.

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).
* Set up a TFTP server on your client and make it serve the initramfs
  image.
* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:
  > rtk network on
* Since the GS1900-10HP is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot off the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:
  > setsys bootpartition 0
  > savesys
* Download the image onto the device and boot from it:
  > tftpboot 0x84f00000 192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-8-initramfs-kernel.bin
  > bootm
* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:
  > sysupgrade /tmp/openwrt-realtek-generic-zyxel_gs1900-8-squashfs-sysupgrade.bin

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-03-14 15:07:30 +01:00
Daniel Golle 79b6a4bd3c
uboot-mediatek: import fix for AHCI and enable SATA
Import patch form Frank Wunderlich <frank-w@public-files.de> to fix
build of MediaTek AHCI SATA driver.
Enable that driver on Bananapi BPi-R64.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-13 20:16:03 +00:00
Daniel Golle 997ff740dc
uboot-mediatek: fix build on Mac OS X
Copy patch added to uboot-sunxi by commit 3cc57ba462
("uboot-sunxi: add missing type __u64") also to uboot-mediatek.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-13 13:41:04 +00:00
Daniel Golle 0183ee2eb9
uboot-mediatek: update configs for MT7622 devies
* make sure USB 2.0 works (useful for UEFI-booting eg. memtest86)
 * include more useful U-Boot config options on BPi-R64.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-12 00:18:58 +00:00
Daniel Golle 9dfc2b3ca4
uboot-mediatek: update to 2021.04-rc3 with MediaTek's patches
MediaTek published their current U-Boot patchset on github:
https://github.com/mtk-openwrt/u-boot/commits/mtksoc

Import the platform patches from there (`00-mtk-*.patch`), arrange,
them nicely, drop no longer needed local patches and rebase on top of
U-Boot 2021.04-rc3.

Tested and works well on Linksys E8450 (snand-1ddr) as well as
Bananapi BPi-R64 (sdmmc-2ddr, emmc-2ddr).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-11 16:24:53 +00:00
Daniel Golle e2cffbb805
arm-trusted-firmware-mediatek: update to 2021-03-10
Most prominently this adds changes which allow replacing the binary-
only 'bromimage' tool by U-Boot's 'mkimage' (see previous commit).
This fixes build on non-Linux and/or non-x86 platforms.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-11 16:24:48 +00:00
Daniel Golle ce19e8fa43
tools: mkimage: add patches for 64-bit MediaTek BootROM
Add patches for mkimage to allow using it instead of the binary-only
'bromimage' tool to generate bl2 for MT7622.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-11 16:24:20 +00:00
Daniel Golle bff84f3e8e arm-trusted-firmware-mediatek: fix typo SPI-SNAND -> SPI-NAND
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-08 21:27:35 +00:00
Daniel Golle eb030a9a82 arm-trusted-firmware-mediatek: prune now uneeded declarations
Remove unneeded delcarations form package Makefile now that everything
comes from github.com/mtk-openwrt upstream.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-06 03:28:52 +00:00
Daniel Golle 9663562188
arm-trusted-firmware-mediatek: don't select DDR3_FLYBY for 1ddr
DDR3_FLYBY has accidentally been set also for the 1-chip variant which
lead to broken, unbootable images. Fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-05 23:55:56 +00:00
Daniel Golle 51ef823f95
uboot-mediatek: improve BPi-R64 support
* allow MAC address from U-Boot env to be inhertied
 * allow eMMC installation to succeed also without recovery present
   on the SD Card.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-05 20:13:54 +00:00
Daniel Golle dc416983bb arm-trusted-firmware-mediatek: update to ATF 2.4 (2021-02-25)
All necessary blobs are now contained in the upstream repository, no
more wild replacing of blobs needed.
This new version also contains new storage drivers for (SPI-)NAND which
already comes with support for FM35Q1GA, so that patch can be dropped
as well.
Tested on:
 * Bananapi BPi-R64
   - sdmmc-2ddr
   - emmc-2ddr
 * Linksys E8450
   - snand-1ddr

All works fine (booting Bananapi BPi-R64 from SD Card does NOT require
a signed image, so patch arm-trusted-firmware-mediatek to allow doing
that).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-05 17:42:10 +00:00
Daniel Golle f3f630145a
arm-trusted-firmware-mediatek: don't try to install absent files
Don't try to install files which no longer exist
Since {e,sd}mmc are now produced by ptgen they have been removed.

Fixes: 5a3562cd1d ("arm-trusted-firmware-mediatek: remove {e,sd}mmc headers")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-04 21:58:40 +00:00
Daniel Golle 5a3562cd1d arm-trusted-firmware-mediatek: remove {e,sd}mmc headers
Turned out those are simply MBR with active boot partition. And not
needed at all on emmc. Remove them as ptgen can now generate hybrid
MBR sufficient to boot MT7622 from SD Card.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-03 01:00:23 +00:00
Daniel Golle e3ab355dde uboot-mediatek: bpi-r64: make sure eMMC installation runs only once
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-02 01:42:34 +00:00
Daniel Golle dba979e2dd uboot-mediatek: bpi-r64: fix eMMC installation menu label
Change boot menu label for eMMC installation to tell what it does now.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-01 20:09:31 +00:00
Daniel Golle ded54ae196 mediatek: mt7622: bpi-r64: simplify eMMC install procedure
Write everything needed for eMMC install into the gaps between
partitions on SD card. In that way, installation to eMMC only needs
the SD card, no additional files need to be loaded via TFTP any more.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-01 19:33:46 +00:00
Georgi Valkov 3cc57ba462 uboot-sunxi: add missing type __u64
Non Linux systems e.g. macOS lack the __u64 type and produce build errors:
In file included from tools/aisimage.c:9:
In file included from include/image.h:19:
In file included from ./arch/arm/include/asm/byteorder.h:29:
In file included from include/linux/byteorder/little_endian.h:13:
include/linux/types.h:146:9: error: unknown type name '__u64'; did you mean '__s64'?
typedef __u64 __bitwise __le64;

Resolved by declaring __u64 in include/linux/types.h
Build tested on macOS and Ubuntu.

Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
2021-03-01 00:34:23 +01:00
Ronny Kotzschmar 547a932ee9 uboot-envtools: adjust compile patch to version v2021.01
with u-boot v2020.07 some variables have been renamed so this patch needs to be adjusted
otherwise at least with macOS as build system there are build errors

Signed-off-by: Ronny Kotzschmar <ro.ok@me.com>
2021-03-01 00:34:22 +01:00
Daniel Golle b102e281a4 uboot-envtools: add defaults for Bananapi BPi-R64
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 04:12:23 +00:00
Daniel Golle 0246e48434 mt7623n-preloader: remove mt7622-preloader
mt7622-preloader has been superseeded by arm-trusted-firmware-mediatek.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 04:12:23 +00:00
Daniel Golle 03948995ab uboot-mediatek: rework support for Bananapi BPi-R64 board
Provide U-Boot variants for SD-card as well as eMMC boot, so we can
generate whole-disk images for the device.
While at it, rename 'mt7622' to 'mt7622-rfb1' to make it less confusing
now that more boards are being added.

Thanks to Frank Wunderlich (@frank-w) for making that nice SVG image
explaining the MMC boot process[1] and for providing the necessary
binary header blobs.

[1]: https://github.com/frank-w/BPI-R64-ATF
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 03:40:35 +00:00
Daniel Golle 42f3efec96 uboot-envtools: add defaults for linksys-e8450-ubi
Add U-Boot environment configuration for the Linksys E8450 (UBI) to
allow access to the bootloader environment from OpenWrt via
'fw_printenv' and 'fw_setenv'.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 01:23:48 +00:00
Daniel Golle ed50004319 uboot-mediatek: add support for Linksys E8450
Build U-Boot for the Linksys E8450 in order to have support for UBI.
The loader has a default environment with scripts handling the reset
button as well as fall-back to recovery firmware. If the loader comes
up without a valid environment found in UBI, it will automatically
make sure UBI is formatted and create a new environment and proceed
to load recovery firmware (either from UBI or via TFTP if recovery is
corrupted or unavailable).

If the button is held down during power-on, the yellow status LED
turns on and the bootloader environment is reset to factory defaults.
If the button is released at this point, the recovery firmware (if
existing) is loaded from UBI and booted.
If the button is continously held down even beyond the point that
the yellow LED turned on, the loader will try to load the recovery
firmware via TFTP from server 192.168.1.254, write it to UBI and
boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 01:23:48 +00:00
Daniel Golle c16958e194 arm-trusted-firmware-mediatek: add patch for Fidelix SPI NAND
The Linksys E8450 aka. Belkin RT3200 comes with a rather fresh brand
of SPI NAND storage. Add support for it to the nandx driver in
arm-trusted-firmware-mediatek, so we can boot from that chip.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 01:23:48 +00:00
Lech Perczak 59d065c9f8 ramips: add support for ZTE MF283+
ZTE MF283+ is a dual-antenna LTE category 4 router, based on Ralink
RT3352 SoC, and built-in ZTE P685M PCIe MiniCard LTE modem.

Hardware highlighs:
- CPU: MIPS24KEc at 400MHz,
- RAM: 64MB DDR2,
- Flash: 16MB SPI,
- Ethernet: 4 10/100M port switch with VLAN support,
- Wireless: Dual-stream 802.11n (RT2860), with two internal antennas,
- WWAN: Built-in ZTE P685M modem, with two internal antennas and two
  switching SMA connectors for external antennas,
- FXS: Single ATA, with two connectors marked PHONE1 and PHONE2,
  internally wired in parallel by 0-Ohm resistors, handled entirely by
  internal WWAN modem.
- USB: internal miniPCIe slot for modem,
  unpopulated USB A connector on PCB.
- SIM slot for the WWAN modem.
- UART connector for the console (unpopulated) at 3.3V,
  pinout: 1: VCC, 2: TXD, 3: RXD, 4: GND,
  settings: 57600-8-N-1.
- LEDs: Power (fixed), WLAN, WWAN (RGB),
  phone (bicolor, controlled by modem), Signal,
  4 link/act LEDs for LAN1-4.
- Buttons: WPS, reset.

Installation:
As the modem is, for most of the time, provided by carriers, there is no
possibility to flash through web interface, only built-in FOTA update
and TFTP recovery are supported.

There are two installation methods:
(1) Using serial console and initramfs-kernel - recommended, as it
allows you to back up original firmware, or
(2) Using TFTP recovery - does not require disassembly.

(1) Using serial console:
To install OpenWrt, one needs to disassemble the
router and flash it via TFTP by using serial console:
- Locate unpopulated 4-pin header on the top of the board, near buttons.
- Connect UART adapter to the connector. Use 3.3V voltage level only,
  omit VCC connection. Pin 1 (VCC) is marked by square pad.
- Put your initramfs-kernel image in TFTP server directory.
- Power-up the device.
- Press "1" to load initramfs image to RAM.
- Enter IP address chosen for the device (defaults to 192.168.0.1).
- Enter TFTP server IP address (defaults to 192.168.0.22).
- Enter image filename as put inside TFTP server - something short,
  like firmware.bin is recommended.
- Hit enter to load the image. U-boot will store above values in
  persistent environment for next installation.
- If you ever might want to return to vendor firmware,
  BACK UP CONTENTS OF YOUR FLASH NOW.
  For this router, commonly used by mobile networks,
  plain vendor images are not officially available.
  To do so, copy contents of each /dev/mtd[0-3], "firmware" - mtd3 being the
  most important, and copy them over network to your PC. But in case
  anything goes wrong, PLEASE do back up ALL OF THEM.
- From under OpenWrt just booted, load the sysupgrade image to tmpfs,
  and execute sysupgrade.

(2) Using TFTP recovery
- Set your host IP to 192.168.0.22 - for example using:
sudo ip addr add 192.168.0.22/24 dev <interface>
- Set up a TFTP server on your machine
- Put the sysupgrade image in TFTP server root named as 'root_uImage'
  (no quotes), for example using tftpd:
  cp openwrt-ramips-rt305x-zte_mf283plus-squashfs-sysupgrade.bin /srv/tftp/root_uImage
- Power on the router holding BOTH Reset and WPS buttons held for around
  5 seconds, until after WWAN and Signal LEDs blink.
- Wait for OpenWrt to start booting up, this should take around a
  minute.

Return to original firmware:
Here, again there are two possibilities are possible, just like for
installation:
(1) Using initramfs-kernel image and serial console
(2) Using TFTP recovery

(1) Using initramfs-kernel image and serial console
- Boot OpenWrt initramfs-kernel image via TFTP the same as for
  installation.
- Copy over the backed up "firmware.bin" image of "mtd3" to /tmp/
- Use "mtd write /tmp/firmware.bin /dev/mtd3", where firmware.bin is
  your backup taken before OpenWrt installation, and /dev/mtd3 is the
  "firmware" partition.

(2) Using TFTP recovery
- Follow the same steps as for installation, but replacing 'root_uImage'
  with firmware backup you took during installation, or by vendor
  firmware obtained elsewhere.

A few quirks of the device, noted from my instance:
- Wired and wireless MAC addresses written in flash are the same,
  despite being in separate locations.
- Power LED is hardwired to 3.3V, so there is no status LED per se, and
  WLAN LED is controlled by WLAN driver, so I had to hijack 3G/4G LED
  for status - original firmware also does this in bootup.
- FXS subsystem and its LED is controlled by the
  modem, so it work independently of OpenWrt.
  Tested to work even before OpenWrt booted.
  I managed to open up modem's shell via ADB,
  and found from its kernel logs, that FXS and its LED is indeed controlled
  by modem.
- While finding LEDs, I had no GPL source drop from ZTE, so I had to probe for
  each and every one of them manually, so this might not be complete -
  it looks like bicolor LED is used for FXS, possibly to support
  dual-ported variant in other device sharing the PCB.
- Flash performance is very low, despite enabling 50MHz clock and fast
  read command, due to using 4k sectors throughout the target. I decided
  to keep it at the moment, to avoid breaking existing devices - I
  identified one potentially affected, should this be limited to under
  4MB of Flash. The difference between sysupgrade durations is whopping
  3min vs 8min, so this is worth pursuing.

In vendor firmware, WWAN LED behaviour is as follows, citing the manual:
- red - no registration,
- green - 3G,
- blue - 4G.
Blinking indicates activity, so netdev trigger mapped from wwan0 to blue:wwan
looks reasonable at the moment, for full replacement, a script similar to
"rssileds" would need to be developed.

Behaviour of "Signal LED" in vendor firmware is as follows:
- Off - no signal,
- Blinking - poor coverage
- Solid - good coverage.

A few more details on the built-in LTE modem:
Modem is not fully supported upstream in Linux - only two CDC ports
(DIAG and one for QMI) probe. I sent patches upstream to add required device
IDs for full support.
The mapping of USB functions is as follows:
- CDC (QCDM) - dedicated to comunicating with proprietary Qualcomm tools.
- CDC (PCUI) - not supported by upstream 'option' driver yet. Patch
  submitted upstream.
- CDC (Modem) - Exactly the same as above
- QMI - A patch is sent upstream to add device ID, with that in place,
  uqmi did connect successfully, once I selected correct PDP context
  type for my SIM (IPv4-only, not default IPv4v6).
- ADB - self-explanatory, one can access the ADB shell with a device ID
  added to 51-android.rules like so:

SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
LABEL="android_usb_rules_begin"
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", ATTR{idProduct}=="1275", ENV{adb_user}="yes"
ENV{adb_user}=="yes", MODE="0660", GROUP="plugdev", TAG+="uaccess"
LABEL="android_usb_rules_end"

While not really needed in OpenWrt, it might come useful if one decides to
move the modem to their PC to hack it further, insides seem to be pretty
interesting. ADB also works well from within OpenWrt without that. O
course it isn't needed for normal operation, so I left it out of
DEVICE_PACKAGES.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[remove kmod-usb-ledtrig-usbport, take merged upstream patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-26 13:57:54 +01:00