Commit Graph

23 Commits

Author SHA1 Message Date
Martin Kennedy
cfe79f2eb8 mpc85xx: Patch HiveAP 330 u-boot to fix boot
When Kernel 5.10 was enabled for mpc85xx, the kernel once again became too
large upon decompression (>7MB or so) to decompress itself on boot (see
FS#4110[1]).

There have been many attempts to fix booting from a compressed kernel on
the HiveAP-330:

- b683f1c36d ("mpc85xx: Use gzip compressed kernel on HiveAP-330")
- 98089bb8ba ("mpc85xx: Use uncompressed kernel on the HiveAP-330")
- 26cb167a5c ("mpc85xx: Fix Aerohive HiveAP-330 initramfs image")

We can no longer compress the kernel due to size, and the stock bootloader
does not support any other types of compression. Since an uncompressed
kernel no longer fits in the 8MiB kernel partition at 0x2840000, we need to
patch u-boot to autoboot by running variable which isn't set by the
bootloader on each autoboot.

This commit repartitions the HiveAP, requiring a new COMPAT_VERSION,
and uses the DEVICE_COMPAT_MESSAGE to guide the user to patch u-boot,
which changes the variable run on boot to be `owrt_boot`; the user can
then set the value of that variable appropriately.

The following has been documented in the device's OpenWrt wiki page:
<https://openwrt.org/toh/aerohive/hiveap-330>. Please look there
first/too for more information.

The from-stock and upgrade from a previous installation now becomes:

0) setup a network with a dhcp server and a tftp server at serverip
(192.168.1.101) with the initramfs image in the servers root directory.

1) Hook into UART (9600 baud) and enter U-Boot. You may need to enter
a password of administrator or AhNf?d@ta06 if prompted. If the password
doesn't work. Try reseting the device by pressing and holding the reset
button with the stock OS.

2) Once in U-Boot, set the new owrt_boot and tftp+boot the initramfs image:
   Use copy and paste!

 # fw_setenv owrt_boot 'setenv bootargs \"console=ttyS0,$baudrate\";bootm 0xEC040000 - 0xEC000000'
 # save
 # dhcp
 # setenv bootargs console=ttyS0,$baudrate
 # tftpboot 0x1000000 192.168.1.101:openwrt-mpc85xx-p1020-aerohive_hiveap-330-initramfs-kernel.bin
 # bootm

3) Once openwrt booted:
carefully copy and paste this into the root shell. One step at a time

  # 3.0 install kmod-mtd-rw from the internet and load it

  opkg update; opkg install kmod-mtd-rw
  insmod mtd-rw i_want_a_brick=y

  # 3.1 create scripts that modifies uboot

cat <<- "EOF" > /tmp/uboot-update.sh
  . /lib/functions/system.sh
  cp "/dev/mtd$(find_mtd_index 'u-boot')" /tmp/uboot
  cp /tmp/uboot /tmp/uboot_patched
  ofs=$(strings -n80 -td < /tmp/uboot | grep '^ [0-9]* setenv bootargs.*cp\.l' | cut -f2 -d' ')
  for off in $ofs; do
    printf "run owrt_boot;            " | dd of=/tmp/uboot_patched bs=1 seek=${off} conv=notrunc
  done
  md5sum /tmp/uboot*
EOF

  # 3.2 run the script to do the modification

  sh /tmp/uboot-update.sh

  # verify that /tmp/uboot and /tmp/uboot_patched are good
  #
  # my uboot was: (is printed during boot)
  # U-Boot 2009.11 (Jan 12 2017 - 00:27:25), Build: jenkins-HiveOS-Honolulu_AP350_Rel-245
  #
  # d84b45a2e8aca60d630fbd422efc6b39  /tmp/uboot
  # 6dc420f24c2028b9cf7f0c62c0c7f692  /tmp/uboot_patched
  # 98ebc7e7480ce9148cd2799357a844b0  /tmp/uboot-update.sh <-- just for reference

  # 3.3 this produces the /tmp/u-boot_patched file.

  mtd write /tmp/uboot_patched u-boot

3) scp over the sysupgrade file to /tmp/ and run sysupgrade to flash OpenWrt:

  sysupgrade -n /tmp/openwrt-mpc85xx-p1020-aerohive_hiveap-330-squashfs-sysupgrade.bin

4) after the reboot, you are good to go.

Other notes:

- Note that after this sysupgrade, the AP will be unavailable for 7 minutes
  to reformat flash. The tri-color LED does not blink in any way to
  indicate this, though there is no risk in interrupting this process,
  other than the jffs2 reformat being reset.

- Add a uci-default to fix the compat version. This will prevent updates
  from previous versions without going through the installation process.

- Enable CONFIG_MTD_SPLIT_UIMAGE_FW and adjust partitioning to combine
  the kernel and rootfs into a single dts partition to maximize storage
  space, though in practice the kernel can grow no larger than 16MiB due
  to constraints of the older mpc85xx u-boot platform.

- Because of that limit, KERNEL_SIZE has been raised to 16m.

- A .tar.gz of the u-boot source for the AP330 (a.k.a. Goldengate) can
  be found here[2].

- The stock-jffs2 partition is also removed to make more space -- this
  is possible only now that it is no longer split away from the rootfs.

- the console-override is gone. The device will now get the console
  through the bootargs. This has the advantage that you can set a different
  baudrate in uboot and the linux kernel will stick with it!

- due to the repartitioning, the partition layout and names got a makeover.

- the initramfs+fdt method is now combined into a MultiImage initramfs.
  The separate fdt download is no longer needed.

- added uboot-envtools to the mpc85xx target. All targets have uboot and
  this way its available in the initramfs.

[1]: https://bugs.openwrt.org/index.php?do=details&task_id=4110
[2]: magnet:?xt=urn:btih:e53b27006979afb632af5935fa0f2affaa822a59

Tested-by: Martin Kennedy <hurricos@gmail.com>
Signed-off-by: Martin Kennedy <hurricos@gmail.com>
(rewrote parts of the commit message, Initramfs-MultiImage,
dropped bootargs-override, added wiki entry + link, uboot-envtools)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-19 19:20:29 +01:00
Pawel Dembicki
ce793584e5 kernel: 5.10: add missing symbols
Three missing symbols were found during mpc85xx/p2020 compilation.

While at it, CONFIG_FSL_ENETC_MDIO is moved to generic config
for consistency.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[move CONFIG_FSL_ENETC_MDIO, remove redundant definitions, adjust
commit message/title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-05 23:54:18 +02:00
Rui Salvaterra
505b7a2d08 kernel: move two symbols to the generic kconfigs
CONFIG_RCU_{NEED_SEGCBLIST,STALL_COMMON} are set basically everywhere. Move them
to the generic kconfigs. And resort the generic kconfigs while at it.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-08-29 17:07:19 +02:00
David Bauer
1c9a9f7c7a treewide: add various missing config symbols
Fixes commit 91a52f22a1 ("treewide: backport support for nvmem on non platform devices")

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-08-10 20:22:59 +02:00
Rui Salvaterra
27b5bae2ec treewide: remove redundant ubifs kconfig symbols
For the targets which enable ubifs, these symbols are already part of the
generic kconfigs. Drop them from the target kconfigs.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-21 10:31:07 +01:00
Pawel Dembicki
1d3b1171ae mpc85xx: add testing kernel 5.10
Subtargets p1010 and p1020 have already added.

Compile and run tested on: P2020RDB

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
2021-03-01 00:34:23 +01:00
David Bauer
08826595fc mpc85xx: add testing kernel for p1020
CONFIG_REGULATOR is required for the p1020 subtarget, as the AT803X
driver depends on it.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-02-22 00:56:16 +01:00
Adrian Schmutzler
598b29585e target: use SPDX license identifiers on Makefiles
Use SPDX license tags to allow machines to check licenses.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-10 15:47:18 +01:00
Aleksander Jan Bajkowski
77575d4c02 kernel: move some disabled symbols to generic
Move some disabled config options found in lantiq target to generic.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
2020-12-22 19:11:50 +01:00
David Bauer
085b445b42 mpc85xx: add missing kernel symbols
These symbols were previously not set. Define their state to avoid
potentially breaking builds.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-03-01 00:51:23 +01:00
David Bauer
fc161063f5 mpc85xx: move NAND symbol to target config
All mpc85xx subtargets utilize NAND, thus enable NAND support
target-wide.

Fixes: 1287bb48dc ("mpc85xx: fix build with kernel 5.4")

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-02-29 00:13:30 +01:00
David Bauer
1287bb48dc mpc85xx: fix build with kernel 5.4
This fixes some outstanding issues with the Kernel 5.4 build:

 * Adds missing support patch for the Enterasys WS-AP3710i
 * Fixes incorrect NAND symbols
 * Adds patch for broken image wrapping

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-02-28 23:32:37 +01:00
David Bauer
16b01fb1b9 mpc85xx: add support for Enterasys WS-AP3710i
Hardware
--------

SoC:   NXP P1020 (2x e500 @ 800MHz)
RAM:   256M DDR3 (Micron)
FLASH: 32M NOR (Spansion S29GL128S)
BTN:   1x Reset
WiFi:  1x Atheros AR9590 2.4 bgn 3x3
       2x Atheros AR9590 5.0 an 3x3
ETH:   1x Gigabit Ethernet (Atheros AR8033)
LED:   System (green/red) - Radio{0,1} (green)
       LAN (connected to PHY)
        - GE blue
        - FE green

Serial is a Cisco-compatible RJ45 next to the ethernet port.
115200-N-8 are the settings for OS and U-Boot.

Installation
------------

1. Grab the OpenWrt initramfs, rename it to 01C8A8C0.img. Place it in
   the root directory of a TFTP server and serve it at
   192.168.200.200/24.

2. Connect to the serial port and boot the AP. Stop autoboot in U-Boot
   by pressing Enter when prompted. Credentials are identical to the one
   in the APs interface. By default it is admin / new2day.

3. Set the bootcmd so the AP can boot OpenWrt by executing

   $ setenv boot_openwrt "setenv bootargs;
     cp.b 0xee000000 0x1000000 0x1000000; bootm 0x1000000"
   $ setenv bootcmd "run boot_openwrt"
   $ saveenv

   If you plan on going back to the vendor firmware - the bootcmd for it
   is stored in the boot_flash variable.

4. Load the initramfs image to RAM and boot by executing

   $ tftpboot 0x1000000 192.168.200.200:01C8A8C0.img; bootm

5. Make a backup of the "firmware" partition if you ever wish to go back
   to the vendor firmware.

6. Upload the OpenWrt sysupgrade image via SCP to the devices /tmp
   folder.

7. Flash OpenWrt using sysupgrade.

   $ sysupgrade -n /tmp/openwrt-sysupgrade.bin

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-12-13 22:40:19 +01:00
David Bauer
b368373fab mpc85xx: add support for OCEDO Panda
CPU:   FSL P1020 (2x 800MHz E500 PPC)
RAM:   1GB DDR3
FLASH: 256MiB NAND
WiFi:  2x Atheros AR9382 2x2:2 abgn
ETH:   2x BCM54616S - 1x BCM53128 8-port switch
LED:   5x LEDs (Power, WiFi1, WiFi2, N/D, SYS)
BTN:   1x RESET

Installation
------------

1. Download initrams kernel image, dtb binary and sysupgrade image.

2. Place initramfs kernel into tftp root directory. Rename to
"panda-uimage-factory".

3. Place dtb binary into tftp root directory. Rename to "panda.fdt".

4. Start tftp server on 192.168.100.8/24.

5. Power up the device with the reset button pressed. It will download
the initrams and dtb via tftp and boot into OpenWRT in RAM.

6. SSH into the device and remove the factory partitions.

 > ubirmvol /dev/ubi0 --name=kernel1
 > ubirmvol /dev/ubi0 --name=rootfs1
 > ubirmvol /dev/ubi0 --name=devicetree1

You will have around 60 MiB of free space with that.

You can also delete "kernel2", "devicetree2", "rootfs2" and "storage"
respectively in case you do not want to go back to the vendor firmware.

7. Modify the U-Boot bootcmd to allow for booting OpenWRT

 > fw_setenv bootcmd_owrt "ubi part ubi && ubi read 0x1000000 kernel
   && bootm 0x1000000"

 > fw_setenv bootargs_owrt "setenv bootargs console=ttyS0,115200
   ubi.mtd=3,2048"

 > fw_setenv bootcmd "run bootargs_owrt; run bootcmd_owrt"

8. Transfer the sysupgrade image via scp into the /tmp directory.

9. Upgrade the device

 > sysupgrade -n /tmp/<imagename>

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-01-26 17:10:19 +01:00
David Bauer
97e4311fca mpc85xx: add support for Sophos RED 15w Rev.1
Hardware
========
CPU:  Freescale P1010 PowerPC
RAM:  128M DDR3
NAND: 128MiB
ETH:  RTL8211F SGMII PHY
      RTL8367B 5-port RGMII switch
      (not connected to SoC - unmanaged)
WiFi: SparkLan WPEA-121N
       - Atheros AR9382 2T2R abgn
USB:  1x USB 2.0
LED:  System, Router, Internet, Tunnel controllable
      LAN1-4, WAN, Power non-controllable
BTN:  None

Installation
============
1. Power on the device while attached to the Console port.

2. Halt the U-Boot by pressing Enter when prompted.

3. Set the correct bootcmd for booting OpenWRT:
 > setenv bootargs_owrt "setenv bootargs console=ttyS0,115200"
 > setenv bootcmd "run bootargs_owrt;
   nand read 0x1000000 0x300000 0x800000;
   bootm 0x1000000;"
 > saveenv

5. Rename OpenWRT initramfs image to 'kernel.bin' and place it in a
   TFTP server root-directory served on 192.168.1.2/24. Connect your
   computer to one of the LAN-ports.

4. Boot OpenWRT initramfs image with
 > run bootargs_owrt; tftpboot 0x1000000 192.168.1.2:kernel.bin;
   bootm 0x1000000;

6. (Optional)
   Make a Backup of 'sophos-os1', 'sophos-os2' and 'sophos-data' in case
   you ever want to go back to the vendor firmware.

7. Create Ubi Volume on mtd4 by executing
 > ubiformat /dev/mtd4 -y

8. Transfer OpenWRT sysupgrade image to the device via SCP and install it
   with
 > sysupgrade -n <openwrt-image-file>

Back to Stock
=============
If you want to go back to the stock firmware, here is the bootcmd of the
vendor firmware:
 > setenv bootargs console=ttyS0,115200 root=/dev/mtdblock5;
   nand read 0xc00000 0x00300000  0x100000;
   nand read 0x1000000 0x00400000 0x00800000;
   bootm 0x1000000 - 0xc00000

Set it via 'setenv' from the U-Boot shell and don't forget to save it
using 'saveenv'!

After this, boot the OpenWRT initramfs image just like you would for
installation. Write back the three vendor partitions using mtd. Reboot
the device afterwards.

Signed-off-by: David Bauer <mail@david-bauer.net>
[refresh and reorder patches]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-01-13 11:31:43 +01:00
Mathias Kresin
79992d197f mpc85xx: cleanup kernel config
Move the kernel config changes added with the HiveAP 330 to the
subtarget the board belongs to instead of changing the target kernel
config.

While at it, move the TL_WDR4900_V1 config symbol to the containing
subtarget and disable boards we don't support.

Signed-off-by: Mathias Kresin <dev@kresin.me>
2017-10-25 09:22:06 +02:00
Chris Blake
ec269290db mpc85xx: use new build code style
The following moves the mpc85xx target (generic & P1020) to the new
build code style.

Compile & Flash tested on an Aerohive HiveAP-330.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
2017-10-25 09:21:54 +02:00
Chris Blake
f2b7d9dc1c mpc85xx: Add Aerohive HiveAP-330 Access Point
The following adds the Aerohive HiveAP-330 Access Point to LEDE under
the mpc85xx/p1020 subtarget.

Hardware:
- SoC: Freescale P1020NSE2DFB
- NAND: Intel JS28F512M29EWH 64MB
- Memory: 2x ProMOS V59C1G01168QBJ3 128MB (Total of 256MB)
- 2.4GHz WiFi: Atheros AR9390-AL1A
- 5.0GHz WiFi: Atheros AR9390-AL1A
- Eth1: Atheros AR8035-A PoE
- Eth2: Atheros AR8035-A
- TPM: Atmel AT97SC3204
- LED Driver: TI LP5521

Flashing:
1. Hook into UART (9600 baud) and enter U-Boot. You may need to enter a
password of administrator or AhNf?d@ta06 if prompted.
2. Once in U-Boot, tftp boot the initramfs image:
    dhcp;
    tftpboot 0x1000000 192.168.1.101:lede-
mpc85xx-p1020-hiveap-330-initramfs.zImage;
    tftpboot 0x6000000 192.168.1.101:lede-mpc85xx-p1020-hiveap-330.fdt;
    bootm 0x1000000 - 0x6000000;
3. Once booted, scp over the sysupgrade file and sysupgrade the device
to flash LEDE to the NAND.
    sysupgrade /tmp/lede-mpc85xx-p1020-hiveap-330-sysupgrade.img

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
2017-10-14 01:23:47 +02:00
Chris Blake
a92f73e922 mpc85xx: Enable initramfs for p1020 subtarget
The following patch enables building of initramfs images by default for
the P1020 subtarget in mpc85xx.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
2017-10-14 01:19:35 +02:00
Felix Fietkau
57690041fa kernel: clean up redundant SLUB/SLAB related defines for 4.4
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48443
2016-01-21 16:08:19 +00:00
Felix Fietkau
93a2b8a6c4 mpc85xx: update to linux 4.4, remove unnecessary patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48297
2016-01-17 21:05:19 +00:00
John Crispin
ce06a742c9 mcp85xx/p1020: fixup config-default
this was missed during the 3.14 bump

Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 43628
2014-12-11 18:39:22 +00:00
Gabor Juhos
c0691e29f1 mpc85xx: Add subtargets Generic and P1020
Only difference between Generic and P1020 is that P1020
enables SMP with two CPUs in the kernel config.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 36454
2013-04-26 16:57:43 +00:00