Adding OpenWrt support for ws-ap3825i

I downloaded the gentoo powerpc musl stage3 version, I extracted the .tar.xz to my USB disk and tried to chroot it, I just tried it again via RJ45-CONSOLE, it outputs some error messages that seem to be about, and I also readelf the gentoo "sh" for reference. What is the problem?

Thanks for the context. I can reproduce. Trying with gdb.


You may want to recompile your Gentoo with a bit less optimization. Here's what I'm getting, with my rootfs mounted at /tmp/chroot:

root@ap3825i3:/tmp/chroot# gdb --args `which chroot` /tmp/chroot bash
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc-openwrt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/chroot...
(No debugging symbols found in /usr/sbin/chroot)
(gdb) run
Starting program: /usr/sbin/chroot /tmp/chroot bash
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
process 13765 is executing new program: /tmp/chroot/bin/bash
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

Program received signal SIGILL, Illegal instruction.
0xb7fb1268 in setjmp () from /tmp/chroot/usr/lib/
(gdb) bt
#0  0xb7fb1268 in setjmp () from /tmp/chroot/usr/lib/
#1  0x0040fbb4 in ?? ()
#2  0xb7f41724 in ?? () from /tmp/chroot/usr/lib/
#3  0xb7f4178c in __libc_start_main () from /tmp/chroot/usr/lib/
#4  0x00411438 in ?? ()
#5  0x004113fc in ?? ()

Quick search points to setjmp hackery making musl unhappy. Have you tested this powerpc musl stage3 on another ppc32?

Here's the relevant bit of setjmp disassembled:

   0xb7fb120c <+0>:	mflr    r0
   0xb7fb1210 <+4>:	stw     r0,0(r3)
   0xb7fb1214 <+8>:	stw     r1,4(r3)
   0xb7fb1218 <+12>:	mfcr    r0
   0xb7fb121c <+16>:	stw     r0,8(r3)
   0xb7fb1220 <+20>:	stw     r14,12(r3)
   0xb7fb1224 <+24>:	stw     r15,16(r3)
   0xb7fb1228 <+28>:	stw     r16,20(r3)
   0xb7fb122c <+32>:	stw     r17,24(r3)
   0xb7fb1230 <+36>:	stw     r18,28(r3)
   0xb7fb1234 <+40>:	stw     r19,32(r3)
   0xb7fb1238 <+44>:	stw     r20,36(r3)
   0xb7fb123c <+48>:	stw     r21,40(r3)
   0xb7fb1240 <+52>:	stw     r22,44(r3)
   0xb7fb1244 <+56>:	stw     r23,48(r3)
   0xb7fb1248 <+60>:	stw     r24,52(r3)
   0xb7fb124c <+64>:	stw     r25,56(r3)
   0xb7fb1250 <+68>:	stw     r26,60(r3)
   0xb7fb1254 <+72>:	stw     r27,64(r3)
   0xb7fb1258 <+76>:	stw     r28,68(r3)
   0xb7fb125c <+80>:	stw     r29,72(r3)
   0xb7fb1260 <+84>:	stw     r30,76(r3)
   0xb7fb1264 <+88>:	stw     r31,80(r3)
=> 0xb7fb1268 <+92>:	.long 0xd9c30058
   0xb7fb126c <+96>:	.long 0xd9e30060
   0xb7fb1270 <+100>:	.long 0xda030068
   0xb7fb1274 <+104>:	.long 0xda230070
   0xb7fb1278 <+108>:	.long 0xda430078
   0xb7fb127c <+112>:	.long 0xda630080
   0xb7fb1280 <+116>:	.long 0xda830088
   0xb7fb1284 <+120>:	.long 0xdaa30090
   0xb7fb1288 <+124>:	.long 0xdac30098
   0xb7fb128c <+128>:	.long 0xdae300a0
   0xb7fb1290 <+132>:	.long 0xdb0300a8
   0xb7fb1294 <+136>:	.long 0xdb2300b0
   0xb7fb1298 <+140>:	.long 0xdb4300b8
   0xb7fb129c <+144>:	.long 0xdb6300c0
   0xb7fb12a0 <+148>:	.long 0xdb8300c8
   0xb7fb12a4 <+152>:	.long 0xdba300d0
   0xb7fb12a8 <+156>:	.long 0xdbc300d8
   0xb7fb12ac <+160>:	.long 0xdbe300e0
   0xb7fb12b0 <+164>:	li      r3,0
   0xb7fb12b4 <+168>:	blr
   0xb7fb12b8 <+172>:	li      r0,119
   0xb7fb12bc <+176>:	sc
   0xb7fb12c0 <+180>:	li      r0,172
   0xb7fb12c4 <+184>:	sc

Here is musl's setjmp. I can't disassemble 0xd9c30058, but maybe it's doing some 64-bit vector register tickling RE evstdd? That is, maybe the compiler is targeting a machine that this is not.

It's even not working on my iBOOK G4 :sweat_smile: maybe this package no one use it and no one check it :rofl:

Hey pros, Have you encountered this situation? I tried USB boot in U-boot, but I can't activate the USB hub, I input
usb start or usb reset
commands and u-boot will said
USB: WARNING: USB phy type not defined !!
Error, couldn't init Lowlevel part
How to solve it? thanks!