What is a lot more interesting: It's a completely different SOC:
From my ISP boot log:
[ 0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
From your AC boot log:
[ 0.000000] SoC: Atheros AR9342 rev 2
Seems that the AC is an earlier version (still a "Atheros" without "Qualcomm"). So I assume they designed that board first and created a cost down version of it later and called it "ISP".
Yes right. It was a bit exaggerated to tell it "completely" different. Most likely it's the same family but a different generation.
@hrns: Do you have enough experience to try to adapt it for yourself? Otherwise: Do you have enough patience for a lot of questions and trial and error via the forum?
Like @psyborg mentioned: The SOCs are only "somewhat different". They have the same core and most likely very similar peripherals. Maybe some more or some less or at other addresses but similar enough. Ubiquiti doesn't use a device tree. Most likely they just check which SOC they are on and initialize slightly different based on the result.
For FDT based systems it would be possible to let U-Boot load the one or the other FDT based on the detected SOC and start the same binary too.
Sorry, but currently there is no simple method. I implemented a driver for the LED controller but it turned out that the GPIO-SPI is too fast and it doesn't accept a slower baudrate. The slower baudrate needs an adaption of the driver in the Linux Kernel. But that touches well optimized code and it's difficult to not have a performance impact for all other targets.
It maybe could work with some tricks in the U-Boot environment. But I would only suggest to touch that if you have access to a serial console and if you have at least some experience with U-Boot. Otherwise it's easy to brick your device.
@c-mauderer I have a very early alpha version of a build that boots on ACB AC, but I'm getting some errors while tftboot procedure. I can see in your notes that your firmware build for ACB ISP was smaller than my current build:
ISP:
ath> setenv serverip 192.168.1.100
ath> help tftpboot
tftpboot [loadAddress] [bootfilename]
ath> tftpboot 0x81000000 openwrt-ath79-generic-ubnt_acb-isp-squashfs-sysupgrade.bin
eth0 link down
enet1 port1 up
dup 1 speed 1000
Using eth1 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.20
Filename 'openwrt-ath79-generic-ubnt_acb-isp-squashfs-factory.bin'.
Load address: 0x81000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#######
done
Bytes transferred = 2031620 (1f0004 hex)
ath> erase 0x9f050000 0x9ffaffff
Erasing flash...
First 0x5 last 0xfa sector size 0x10000
250
Erased 246 sectors
ath> cp 0x81000000 0x9f050000 ${filesize}
Copy to Flash... write addr: 9f050000
done
ath> reset
AC:
ar7240> tftpboot 0x81000000 openwrt-ath79-generic-ubnt_acb-ac-squashfs-sysupgrade.bin
Using eth0 device
TFTP from server 192.168.1.10; our IP address is 192.168.1.20
Filename 'openwrt-ath79-generic-ubnt_acb-ac-squashfs-sysupgrade.bin'.
Load address: 0x81000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##########################
done
Bytes transferred = 4457217 (440301 hex)
ar7240> erase 0x9f050000 0x9ffaffff
............................................................................................................................................................................................e
Erased 246 sectors
ar7240> cp 0x81000000 0x9f050000 ${filesize}
Copy to Flash... Outside available Flash
ar7240> echo ${filesize}
440301
My guess is that I didn't erase enough memory. If so, how did you calculate the upper address for erase command?
That's odd. Your firmware shouldn't be much bigger. You only have one additional driver. That should be far less then 100 or 200kByte. Do you have your patch uploaded somewhere so that I can take a look at it?
Be very careful with the erase command. There is a calibration data section at the end of the flash. If you overwrite that you will brick your device.
Regarding the sizes: There are multiple possibilities: One is to take a look at the mtd partitions. In U-Boot:
Note that the addresses are from start of flash. To get the start address you can use the U-Boot command bdinfo.
u-boot and u-boot-env are for U-Boot. EEPROM contains calibration data and must not be removed. I would expect that cfg contains the original firmware configuration but I'm not entirely sure. Therefore I wouldn't suggest to remove that.
If you want to make sure that you don't loose the calibration data: Make a backup. The original U-Boot isn't very well equipped. So I think the only possibility for the backup is to use memory dump (md) of big blocks and save the output to a text file. In the worst case you can convert that to something useful.
But anyway: Your image has 4457217 Bytes (0x440301). If you add that to the start address you get 0x9f490301 which is still not outside of your flash. So the error is odd. Make sure that your start addresses are all the same.
Except for the original firmware it seems that AC build and ISP build are quite similar. I can't reproduce the tftboot procedure with any of them. @c-mauderer in your notes the image is smaller than the one uploaded to openwrt site, maybe I should use other tool (like fwgen from your github) to build the image?
It has 16 MB of flash. You aren't anywhere close to running out of space.
Always use cp.b to copy in terms of bytes. I think u-boot with a regular cp assumes the size is in 32-bit words, which is going to exceed the flash (and if you're really unlucky, clobber the ART).
To back up the ART, boot stock firmware and run cat /dev/mtd5 > /tmp/art.bin This should produce a file of exactly 65536 bytes. SCP the file to your PC and save it in a safe place.
Maybe you are aware of it, but I found that calibration is made accessible from /lib/firmware/ath10k/cal-pci-0000:00:00.0.bin which is a symbolic link to /tmp/ath10k/cal-pci-0000:00:00.0.bin.
That file is exactly 2116 bytes long and it is an extract from /dev/mtd5 at offset 0x5000
I don't know how that file is created with stock firmware nor needed with OpenWrt.
Finally got serial console working (thanks rpi). I made a custom OpenWrt sysupgrade image derivated from your work.
MTD are the same, making job easier. Unfortunately, kernel failed on SPI probing:
[ 0.424895] m25p80 spi0.0: unrecognized JEDEC id bytes: 00, 00, 00
[ 0.431203] m25p80: probe of spi0.0 failed with error -2
Can someone points me in a good direction for solving this issue?
I tried modifying DTS but no luck...
That's basically the information what kind of SPI flash has been connected. It seems that your system received a 00 00 00 when it tried to read the ID of the flash chip. That means that there is nothing connected. 3 possible reasons:
There really is no SPI flash. In that case the AC maybe boots from some other source. Take a look at the PCB whether there is a SPI flash or not.
The flash is connected to another SPI peripheral. That's not unlikely.
The controller uses different pins for the SPI. Also not unlikely.
2 and 3 would point toward a bug in the FDT. You maybe have to adapt it to fit the AC. Best guess is to compare it to FDTs of other routers with the same chip like used on the AC.
Best regards
Christian
PS: Seems that the mail reply I tried first didn't work. If you get the same response twice it maybe worked a bit later
That's basically the information what kind of SPI flash has been
connected. It seems that your system received a 00 00 00 when it tried
to read the ID of the flash chip. That means that there is nothing
connected. 3 possible reasons:
There really is no SPI flash. In that case the AC maybe boots from
some other source. Take a look at the PCB whether there is a SPI flash
or not.
The flash is connected to another SPI peripheral. That's not unlikely.
The controller uses different pins for the SPI. Also not unlikely.
2 and 3 would point toward a bug in the FDT. You maybe have to adapt it
to fit the AC. Best guess is to compare it to FDTs of other routers with
the same chip like used on the AC.
I wanted to share my experience. Finally I managed to boot a brand new OpenWrt firmware on Aircube AC. The DTS was almost good, I just updated OpenWrt to 19.07.3 (was on your experimental branch as of now) and the SPI Flash was detected.
I had to modify the eth0 definition in the DTS.
So far, almost everything is working, except blinking led, as you pointed already.
For this last point, uboot is capable of managing the led when in urescue mode (the speed is changing), so I think the definition to that led should not be so "exotic".
Again, thank you for initiating the port to Aircube as my work was utterly based on yours.