pablomarx / airdecrypt

Tool for decrypting (most) Apple AirPort firmware images
MIT License
4 stars 1 forks source link

Encrypt firmware back #1

Open gchehab opened 3 years ago

gchehab commented 3 years ago

Hey, great work you have done with airdecrypt I have worked a little on tweaking an old airport extreme 6th gen. I got some interesting things done. So far have managed to compile a fully working static NetBSD 7.2 build for it and even some packages from pkgsrc, like rsync, and OpenVPN. https://github.com/ipatch/theairportwiki/wiki/build-a-cross-compile-NetBSD-toolchain-armv6-Notes However, the next step and the major limitation, I faced, is on the embedded kernel, which limits it to statically linked binaries, ARMv6 (even though it supports ARMv7), and uses only one of the CPU cores -- yes, my unit should have two cores, but only one work. Do you happen to check if it is possible to recreate the encrypted package with a new kernel image, for instance?

pablomarx commented 3 years ago

@gchehab You don't need to create an encrypted package – both the Airport Utility and Airport firmware will happily flash anything (I've done this to get OpenWRT on a few models). As long as the Adler-32 checksum at the end is valid.

When you create the package you'll just need to ensure the flags don't specify encryption, e.g.:

https://github.com/pablomarx/airdecrypt/blob/b3f9500af4da20da17cfbbc545914c13c6ea0f14/airdecrypt.c#L131-L132

Ensure that flag isn't 2 and it should be fine.

gchehab commented 3 years ago

Well, an OpenWRT port for it would be even better! How did you do it? I looked on the project's site for info on running it on Apple devices but did not find any evidence that any had already did it. Do you have any resources or info that you could share? On what devices have you manage to get it working and did you manage to have full dual-band wifi support?

pablomarx commented 3 years ago

I haven't touched the OpenWRT stuff since early 2017 – so this is based off hazy memories. I added support for the second gen AirPort Express in this repo:

https://github.com/pablomarx/openwrt/commit/9fe3e9d2baecc80915d2578127297a1053c6e7db

Somewhere locally I have support for extremes/time capules except for the last gen. They were functional except for wifi. I can try and dig up the patches and add them to that repo.

Here is a full boot log from the second gen AirPort express demonstrating it was reasonably functional: both ethernet ports worked, wifi didn't error out, flash&partitions were fine, i2c bus worked, usb seems okay, etc. Admittedly this shows me tfp booting the image, but it looks like I have a basebinary firmware image I made for it. I'd want to test it before sharing it though.

CFE version 1.4.2 for K31 (32bit,SP,BE,MIPS)
Build Date: Tue Jan 22 21:44:44 PST 2013 (root@twilight.apple.com)
Atheros release version: 2012-1-15
Copyright (C) 2000,2001,2002,2003,2004,2005 Broadcom Corporation.

Initializing Arena.
Initializing Devices.
APPLE BOOTLOADER INFO: Apple CFE (bcm: 1.4.2 ath: 2012-1-15 apple: a4) prodVer:7.6.3 Jan 22 2013 21:44:43
AR934X_REV_ID:0x18060090=0x2123
CPU PLL Locked in 1 attempt(s)
DDR PLL Locked in 1 attempt(s)
CPU_SQSUM=0x430005d8
DDR_SQSUM=0x03000bf8
Flash init...... 0x1000000 (16 MB)
Eth init......
ag7240_init: baseaddr = 19000000, unit = 0 sOneTime=0
ag7240_init: baseaddr = 1a000000, unit = 1 sOneTime=1
WASP ----> S27 PHY MDIO
gpio read......0x0081331b/0x00037f20/0x00024800
CPU type 0x1974C: 480MHz
Total memory: 0x4000000 bytes (64MB)

Total memory used by CFE:  0x83F85000 - 0x83FFF3A0 (500640)
Initialized Data:          0x83FBB260 - 0x83FBCEB0 (7248)
BSS Area:                  0x83FBCEB0 - 0x83FBD390 (1248)
Local Heap:                0x83FBD3A0 - 0x83FFD3A0 (262144)
Stack Area:                0x83FFD3A0 - 0x83FFF3A0 (8192)
Text (code) segment:       0x83F85000 - 0x83FB858C (210316)
Boot area (physical):      0x03F44000 - 0x03F84000
Relocation Factor:         I:E4385000 - D:E4385000

Press any key to stop, OR autoboot will start in  1 s
CFE>  ifconfig eth0 -auto
ar934x_eth_cfe_open: open
ag7240_ring_alloc Allocated 96 at 0x83fbf400
ag7240_ring_alloc Allocated 96 at 0x83fbf480
ag7240_ring_alloc Allocated 96 at 0x83fbf500
ag7240_ring_alloc Allocated 96 at 0x83fbf580
ag7240_open filled 8 tx buffers for MAC0
ag7240_open filled 8 rx buffers for MAC0
WASP ----> S27 PHY MDIO
Setting Drop CRC Errors, Pause Frames and Length Error frames
ag7240_hw_setup: cfg1 5 cfg2 7114
S27 PHY reg init......
ATHRS27: athrs27_reg_init...
_ui_mii_attach():
Power off un-used PHYs, PHY1/PHY2/PHY3
athrs27_phy_setup ATHR_PHY_CONTROL 4 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 4 :10
Device eth0:  hwaddr 28-CF-E9-7F-95-00, ipaddr 10.0.1.49, mask 255.255.255.0
        gateway 10.0.1.1, nameserver 10.0.1.1, domain hsd1.ca.comcast.net.
*** command status = 0
CFE> boot -elf 10.0.1.4:vmlinux.elf
Loader:elf Filesys:tftp Dev:eth0 File:10.0.1.4:vmlinux.elf Options:(null)
Loading: 0x80060000/5662500 0x805c6724/232496 Entry at 0x800650e0
Closing network.
ag7240_ring_free Freeing at 0xa3fbf400
ag7240_ring_free Freeing at 0xa3fbf500
Starting program at 0x800650e0

[    0.000000] Linux version 3.18.44 (swhite@ubuntu) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r49389) ) #129 Sat Dec 3 08:59:28 PST 2016
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001974c (MIPS 74Kc)
[    0.000000] SoC: Atheros AR9344 rev 3
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x03ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200 board=APPLE-K31
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 58768K/65536K available (2529K kernel code, 145K rwdata, 540K rodata, 2344K init, 188K bss, 6768K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:500.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:40.000MHz
[    0.000000] Calibrating delay loop... 249.44 BogoMIPS (lpj=1247232)
[    0.070000] pid_max: default: 32768 minimum: 301
[    0.070000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090000] NET: Registered protocol family 16
[    0.090000] MIPS: machine is Apple Airport Express K31
[    0.100000] ar724x-pci ar724x-pci: PCIe link is down
[    0.110000] registering PCI controller with io_map_base unset
[    0.560000] i2c-gpio i2c-gpio.0: using pins 13 (SDA) and 12 (SCL)
[    0.560000] PCI host bridge to bus 0000:00
[    0.570000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[    0.570000] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.580000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.580000] Switched to clocksource MIPS
[    0.590000] NET: Registered protocol family 2
[    0.590000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.590000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.600000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.610000] TCP: reno registered
[    0.610000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.620000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.620000] NET: Registered protocol family 1
[    3.610000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    3.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    3.630000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    3.650000] msgmni has been set to 114
[    3.650000] io scheduler noop registered
[    3.660000] io scheduler deadline registered (default)
[    3.660000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    3.670000] console [ttyS0] disabled
[    3.690000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 2500000) is a 16550A
[    3.700000] console [ttyS0] enabled
[    3.700000] console [ttyS0] enabled
[    3.710000] bootconsole [early0] disabled
[    3.710000] bootconsole [early0] disabled
[    3.720000] m25p80 spi0.0: found w25q128, expected m25p80
[    3.730000] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    3.740000] Creating 5 MTD partitions on "spi0.0":
[    3.740000] 0x000000000000-0x000000080000 : "boot"
[    3.750000] 0x000000080000-0x0000000c0000 : "scfg"
[    3.750000] 0x0000000c0000-0x000000200000 : "dcfg"
[    3.760000] 0x000000200000-0x000000900000 : "primary"
[    3.760000] 0x000000900000-0x000001000000 : "secondary"
[    3.790000] libphy: ag71xx_mdio: probed
[    4.380000] ag71xx-mdio.1: Found an AR934X built-in switch
[    4.420000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    5.020000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    5.020000] i2c /dev entries driver
[    5.030000] TCP: cubic registered
[    5.030000] NET: Registered protocol family 17
[    5.040000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    5.050000] 8021q: 802.1Q VLAN Support v1.8
[    5.070000] Freeing unused kernel memory: 2344K (80386000 - 805d0000)
[    5.090000] init: Console is alive
[    5.100000] init: - watchdog -
[    5.130000] usbcore: registered new interface driver usbfs
[    5.130000] usbcore: registered new interface driver hub
[    5.140000] usbcore: registered new device driver usb
[    5.150000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.160000] ehci-platform: EHCI generic platform driver
[    5.160000] ehci-platform ehci-platform: EHCI Host Controller
[    5.170000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    5.180000] ehci-platform ehci-platform: TX-TX IDP fix enabled
[    5.190000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    5.210000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    5.210000] hub 1-0:1.0: USB hub found
[    5.220000] hub 1-0:1.0: 1 port detected
[    5.220000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.230000] ohci-platform: OHCI generic platform driver
[    6.100000] init: - preinit -
[    6.360000] random: mktemp urandom read with 10 bits of entropy available
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    7.910000] eth0: link up (1000Mbps/Full duplex)
[    9.490000] eth0: link down
[    9.500000] procd: - early -
[    9.500000] procd: - watchdog -
[   10.060000] procd: - ubus -
[   11.080000] procd: - init -
Please press Enter to activate this console.
[   11.880000] NET: Registered protocol family 10
[   11.890000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   11.910000] Loading modules backported from Linux version v4.4-rc5-1913-gc8fdf68
[   11.920000] Backport generated by backports.git backports-20151218-0-g2f58d9d
[   11.930000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   11.950000] nf_conntrack version 0.5.0 (954 buckets, 3816 max)
[   11.990000] xt_time: kernel timezone is -0000
[   12.100000] PPP generic driver version 2.4.2
[   12.110000] NET: Registered protocol family 24
[   12.180000] ieee80211 phy0: Atheros AR9340 Rev:3 mem=0xb8100000, irq=47
[   20.370000] device eth0 entered promiscuous mode
[   20.400000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   20.440000] eth1: link up (100Mbps/Full duplex)
[   21.970000] eth0: link up (1000Mbps/Full duplex)
[   21.970000] br-lan: port 1(eth0) entered forwarding state
[   21.980000] br-lan: port 1(eth0) entered forwarding state
[   22.000000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   23.980000] br-lan: port 1(eth0) entered forwarding state

BusyBox v1.23.2 (2016-12-03 01:52:26 PST) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 CHAOS CALMER (Chaos Calmer, r49389)
 -----------------------------------------------------
  * 1 1/2 oz Gin            Shake with a glassful
  * 1/4 oz Triple Sec       of broken ice and pour
  * 3/4 oz Lime Juice       unstrained into a goblet.
  * 1 1/2 oz Orange Juice
  * 1 tsp. Grenadine Syrup
 -----------------------------------------------------
root@OpenWrt:/# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr 28:CF:E9:7F:95:02
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2acf:e9ff:fe7f:9502/64 Scope:Link
          inet6 addr: fd3c:ab94:863d::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:94 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:14313 (13.9 KiB)  TX bytes:3873 (3.7 KiB)

eth0      Link encap:Ethernet  HWaddr 28:CF:E9:7F:95:02
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:108 errors:0 dropped:10 overruns:0 frame:0
          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18095 (17.6 KiB)  TX bytes:3919 (3.8 KiB)
          Interrupt:5

eth1      Link encap:Ethernet  HWaddr 28:CF:E9:7F:95:01
          inet addr:10.0.1.60  Bcast:10.0.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2acf:e9ff:fe7f:9501/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5221 (5.0 KiB)  TX bytes:2924 (2.8 KiB)
          Interrupt:4

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 28:CF:E9:7F:95:00
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@OpenWrt:/# ping -c 5 8.8.4.4
PING 8.8.4.4 (8.8.4.4): 56 data bytes
64 bytes from 8.8.4.4: seq=0 ttl=57 time=16.601 ms
64 bytes from 8.8.4.4: seq=1 ttl=57 time=28.441 ms
64 bytes from 8.8.4.4: seq=2 ttl=57 time=15.582 ms
64 bytes from 8.8.4.4: seq=3 ttl=57 time=37.638 ms
64 bytes from 8.8.4.4: seq=4 ttl=57 time=21.808 ms

--- 8.8.4.4 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 15.582/24.014/37.638 ms
root@OpenWrt:/# ping -c 5 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=0.781 ms
64 bytes from 192.168.1.2: seq=1 ttl=64 time=0.664 ms
64 bytes from 192.168.1.2: seq=2 ttl=64 time=0.641 ms
64 bytes from 192.168.1.2: seq=3 ttl=64 time=0.687 ms
64 bytes from 192.168.1.2: seq=4 ttl=64 time=0.682 ms

--- 192.168.1.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.641/0.691/0.781 ms
root@OpenWrt:/# cat /proc/cpuinfo
system type             : Atheros AR9344 rev 3
machine                 : Apple Airport Express K31
processor               : 0
cpu model               : MIPS 74Kc V4.12
BogoMIPS                : 249.44
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16 dsp dsp2
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

root@OpenWrt:/# cat /proc/devices
Character devices:
  1 mem
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
 10 misc
 89 i2c
 90 mtd
108 ppp
128 ptm
136 pts
180 usb
189 usb_device
254 ttyATH

Block devices:
259 blkext
 31 mtdblock
root@OpenWrt:/# [   65.120000] random: nonblocking pool is initialized
cat /proc/meminfo
MemTotal:          61112 kB
MemFree:           43676 kB
MemAvailable:      49564 kB
Buffers:               0 kB
Cached:             7996 kB
SwapCached:            0 kB
Active:             6264 kB
Inactive:           3084 kB
Active(anon):       1392 kB
Inactive(anon):       32 kB
Active(file):       4872 kB
Inactive(file):     3052 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          1368 kB
Mapped:             1464 kB
Shmem:                72 kB
Slab:               4508 kB
SReclaimable:        760 kB
SUnreclaim:         3748 kB
KernelStack:         256 kB
PageTables:          208 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       30556 kB
Committed_AS:       3732 kB
VmallocTotal:    1048372 kB
VmallocUsed:         648 kB
VmallocChunk:    1042644 kB
root@OpenWrt:/# hexdump -C -n 1400 /dev/mtd0
00000000  10 00 01 6b 00 00 00 00  00 00 00 00 00 00 00 00  |...k............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200  10 00 02 3d 00 00 00 00  00 00 00 00 00 00 00 00  |...=............|
00000210  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000280  10 00 02 25 24 1a 00 10  00 00 00 00 00 00 00 00  |...%$...........|
00000290  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000300  10 00 02 0d 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000310  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000380  10 00 01 ef 24 1a 00 20  00 00 00 00 00 00 00 00  |....$.. ........|
00000390  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  10 00 01 d2 24 1a 00 28  00 00 00 00 00 00 00 00  |....$..(........|
00000410  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000480  10 00 01 b5 24 1a 00 30  00 00 00 00 00 00 00 00  |....$..0........|
00000490  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000004e0  43 46 45 31 43 46 45 31  00 00 00 00 00 00 00 00  |CFE1CFE1........|
000004f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000500  10 00 00 25 00 00 00 00  43 46 45 31 43 46 45 31  |...%....CFE1CFE1|
00000510  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000570
root@OpenWrt:/# uci show wireless
wireless.radio0=wifi-device
wireless.radio0.type='mac80211'
wireless.radio0.channel='11'
wireless.radio0.hwmode='11g'
wireless.radio0.path='platform/ar934x_wmac'
wireless.radio0.htmode='HT20'
wireless.radio0.disabled='1'
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device='radio0'
wireless.@wifi-iface[0].network='lan'
wireless.@wifi-iface[0].mode='ap'
wireless.@wifi-iface[0].ssid='OpenWrt'
wireless.@wifi-iface[0].encryption='none'
root@OpenWrt:/# uci set wireless.@wifi-device[0].disabled=0
root@OpenWrt:/# uci commit wireless
root@OpenWrt:/# wifi
[  143.700000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  143.720000] device wlan0 entered promiscuous mode
[  143.770000] br-lan: port 2(wlan0) entered forwarding state
[  143.780000] br-lan: port 2(wlan0) entered forwarding state
[  143.780000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  145.780000] br-lan: port 2(wlan0) entered forwarding state
[  154.010000] device wlan0 left promiscuous mode
[  154.010000] br-lan: port 2(wlan0) entered disabled state
[  154.580000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  154.600000] device wlan0 entered promiscuous mode
[  154.610000] br-lan: port 2(wlan0) entered forwarding state
[  154.610000] br-lan: port 2(wlan0) entered forwarding state
[  154.640000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  156.610000] br-lan: port 2(wlan0) entered forwarding state
root@OpenWrt:/# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 28:CF:E9:7F:95:00
          inet6 addr: fe80::2acf:e9ff:fe7f:9500/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:666 errors:0 dropped:0 overruns:0 frame:0
          TX packets:789 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:71882 (70.1 KiB)  TX bytes:790747 (772.2 KiB)

root@OpenWrt:/# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- 11 -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pablomarx commented 3 years ago

This is a DTS for the K10A, the fourth gen extreme. I remember it having working ethernet:

/*
 * kirkwood-apple-k10a.dts - Device Tree file for Apple AirPort Extreme
 *
 * (c) 2017 Steve White <swhite@swhite.co>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

/dts-v1/;

#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"

/ {
        model = "Apple AirPort Extreme (K10A / A1354)";
        compatible = "apple,k10", "marvell,kirkwood-88f6281", "marvell,kirkwood";

        memory {
                device_type = "memory";
                reg = <0x00000000 0x8000000>;
        };

        chosen {
                bootargs = "console=ttyS0,115200n8 earlyprintk";
                stdout-path = &uart0;
        };

        mbus {
                pcie-controller {
                        status = "okay";

                        pcie@1,0 {
                                status = "okay";
                        };
                };
        };

        ocp@f1000000 {
                pinctrl: pin-controller@10000 {
                        pmx_uart0: pmx-uart0 {
                                marvell,pins = "mpp4", "mpp5";
                        };
                        // XXX ???
                        pmx_switch_power_enable: pmx-switch-power-enable {
                                marvell,pins = "mpp15";
                                marvell,function = "gpio";
                        };
                        pmx_btn_reset: pmx-btn-reset {
                                marvell,pins = "mpp38";
                                marvell,function = "gpio";
                        };
                        pmx_led_yellow: pmx-led_yellow {
                                marvell,pins = "mpp44";
                                marvell,function = "gpio";
                        };
                        pmx_led_green: pmx-led_green {
                                marvell,pins = "mpp45";
                                marvell,function = "gpio";
                        };
                        pmx_led_blue: pmx-led_blue {
                                marvell,pins = "mpp46";
                                marvell,function = "gpio";
                        };
                        pmx_usb_power_enable: pmx-usb-power-enable {
                                marvell,pins = "mpp48";
                                marvell,function = "gpio";
                        };
                };
                serial@12000 {
                        status = "okay";
                };
                rtc@10300 {
                        status = "disabled";
                };
                ehci@50000 {
                        status = "okay";
                };
        };

        gpio-leds {
                compatible = "gpio-leds";
                pinctrl-0 = <&pmx_led_green &pmx_led_yellow &pmx_led_blue>;
                pinctrl-names = "default";

                yellow {
                        label = "status:yellow:misc";
                        gpios = <&gpio1 12 1>;
                };
                blue {
                        label = "status:blue:misc";
                        gpios = <&gpio1 14 1>;
                };
                green {
                        label = "status:green:misc";
                        gpios = <&gpio1 13 1>;
                };
        };

        gpio_keys {
                compatible = "gpio-keys";
                pinctrl-0 = <&pmx_btn_reset>;
                pinctrl-names = "default";

                button@1 {
                        label = "Reset Button";
                        linux,code = <KEY_RESTART>;
                        gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
                };
        };

        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-0 = <&pmx_usb_power_enable>;
                pinctrl-names = "default";

                usb_power: regulator@1 {
                        compatible = "regulator-fixed";
                        reg = <1>;
                        regulator-name = "USB Power";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        enable-active-high;
                        regulator-always-on;
                        regulator-boot-on;
                        gpio = <&gpio1 16 GPIO_ACTIVE_HIGH>;
                };
                switch_power: regulator@2 {
                        compatible = "regulator-fixed";
                        reg = <2>;
                        regulator-name = "Switch Power";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        enable-active-high;
                        regulator-always-on;
                        regulator-boot-on;
                        gpio = <&gpio0 15 GPIO_ACTIVE_HIGH>;
                };
        };

        mvsw61xx {
                compatible = "marvell,88e6171";
                status = "okay";
                reg = <0x10>;

                mii-bus = <&mdio>;
                cpu-port-0 = <5>;
                cpu-port-1 = <6>;
                is-indirect;
        };
};

&i2c0 {
        status = "okay";
        clock-frequency = <400000>;

        isl1208: isl1208@6f {
                compatible = "isil,isl1208";
                reg = <0x6f>;
        };
};

&spi0 {
        status = "okay";
        flash@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "winbond,w25q128", "jedec,spi-nor";
                spi-max-frequency = <15625000>;
                reg = <0>;
                mode = <0>;

                partition@0 {
                        reg = <0x00000000 0x80000>;
                        label = "bootloader";
                };
                partition@80000{
                        reg = <0x00080000 0x40000>;
                        label = "bootloader env";
                };
                partition@c0000{
                        reg = <0x000c0000 0x140000>;
                        label = "user";
                };
                partition@200000{
                        reg = <0x00200000 0x700000>;
                        label = "primary";
                };
                partition@900000{
                        reg = <0x00900000 0x700000>;
                        label = "secondary";
                };
        };
};

&mdio {
        status = "okay";
};

&eth0 {
        status = "okay";
        ethernet0-port@0 {
                speed = <1000>;
                duplex = <1>;
        };
};

&eth1 {
        status = "okay";
        ethernet1-port@0 {
                speed = <1000>;
                duplex = <1>;
        };
};
gchehab commented 3 years ago

Well, my unit is actually a last-gen Airport Time Capsule, with a Broadcom BCM5301 SoC (Cortex-A9 core) and a BCM4360 wifi controller. As it seems, no opensource driver is available for this wifi controller, so it is badly supported.

But first things first, I will try to find out how I can attach a serial interface on it to boot it through TFTP, and my serial adapter is Bluetooth which is hardly suited to trace early booting messages. I will need to find a USB one.