Upgrading an old OpenWrt (AP147)

Hi,

I have hardware with very old & customized openwrt, I want to upgrade to latest (18.x) version
However, compiling the firmware leads to a non working device.

Based on previous chat on forum, I identified to the platform to be Ar71xxx/AP147 (Qualcom QCA9531) . Below the info I get from the console and my compilation options.

Your help very welcome

DMESG

# dmesg
[    0.000000] Linux version 3.3.8 (yangyi@ubuntu) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Tue Oct 31 17:51:29 CST 2017
[    0.000000] MyLoader: sysp=79be49ca, boardp=cac6dd47, parts=cc125dc6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9531 rev 2
[    0.000000] Clocks: CPU:650.000MHz, DDR:597.436MHz, AHB:216.666MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00004000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00004000
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 803c0090, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16256 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=AP147 console=ttyS0,115200 mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1472k(kernel),64k(art),16000k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd
(...)
[    0.700000] 0x000000000000-0x000000040000 : "u-boot"
[    0.710000] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.710000] 0x000000050000-0x000000e80000 : "rootfs"
[    0.720000] mtd: partition "rootfs" set to be root filesystem
[    0.730000] mtd: partition "rootfs_data" created automatically, ofs=B20000, len=360000 
[    0.740000] 0x000000b20000-0x000000e80000 : "rootfs_data"
[    0.740000] 0x000000e80000-0x000000ff0000 : "kernel"
[    0.750000] 0x000000ff0000-0x000001000000 : "art"
[    0.750000] 0x000000050000-0x000000ff0000 : "firmware"
[    0.780000] ag71xx_mdio: probed
[    0.810000] ar8216: Unknown Atheros device [ver=2, rev=1, phy_id=004dd042]
[    0.840000] ar8216: Unknown Atheros device [ver=2, rev=1, phy_id=004dd042]
[    0.860000] ar8216: Unknown Atheros device [ver=2, rev=1, phy_id=004dd042]
[    0.890000] ar8216: Unknown Atheros device [ver=2, rev=1, phy_id=004dd042]
[    0.910000] ar8216: Unknown Atheros device [ver=2, rev=1, phy_id=004dd042]
[    0.920000] ag71xx_mdio: probed
[    0.920000] eth0: Atheros AG71xx at 0xb9000000, irq 4
[    1.480000] ag71xx ag71xx.0: eth0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    1.490000] eth1: Atheros AG71xx at 0xba000000, irq 5
[    2.050000] eth1: Found an AR934X built-in switch

FW_PRINTENV

# fw_printenv 
bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),14528k(rootfs),1408k(uImage),64k(mib0),64k(ART)
bootcmd=bootm 0x9fe80000
bootdelay=2
baudrate=115200
ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
dir=
lu=tftp 0x80060000 ${dir}u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
lf=tftp 0x80060000 ${dir}ap152${bc}-jffs2&&erase 0x9f050000 +0xE30000&&cp.b $fileaddr 0x9f050000 $filesize
lk=tftp 0x80060000 ${dir}vmlinux${bc}.lzma.uImage&&erase 0x9fe80000 +$filesize&&cp.b $fileaddr 0x9fe80000 $filesize
stdin=serial
stdout=serial
stderr=serial
ethact=eth0
ipaddr=192.168.0.144
serverip=192.168.0.141
mode=0
sname=austin

COMPILATION PARAMS (./scripts/diffconfig.sh)


CONFIG_TARGET_ar71xx=y
CONFIG_TARGET_ar71xx_generic=y
CONFIG_TARGET_ar71xx_generic_DEVICE_AP147_010=y
CONFIG_ATH9K_SUPPORT_PCOEM=y
CONFIG_BUILD_PATENTED=y
# CONFIG_BUSYBOX_DEFAULT_FEATURE_IPV6 is not set
CONFIG_CLEAN_IPKG=y
# CONFIG_IPV6 is not set
# CONFIG_KERNEL_CRASHLOG is not set
# CONFIG_KERNEL_DEBUG_INFO is not set
# CONFIG_KERNEL_DEBUG_KERNEL is not set
CONFIG_KERNEL_DEVKMEM=y
CONFIG_KERNEL_DEVMEM=y
# CONFIG_KERNEL_ELF_CORE is not set
# CONFIG_KERNEL_IPV6 is not set
# CONFIG_KERNEL_KALLSYMS is not set
CONFIG_KERNEL_KEXEC=y
# CONFIG_KERNEL_MAGIC_SYSRQ is not set
CONFIG_LUCI_SRCDIET=y
CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM=y
CONFIG_OPENSSL_WITH_ASM=y
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
CONFIG_OPENSSL_WITH_CMS=y
CONFIG_OPENSSL_WITH_DEPRECATED=y
CONFIG_OPENSSL_WITH_EC=y
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y
CONFIG_OPENSSL_WITH_NPN=y
CONFIG_OPENSSL_WITH_PSK=y
CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_blockd=y
CONFIG_PACKAGE_bridge=y
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_davfs2=y
# CONFIG_PACKAGE_dnsmasq is not set
CONFIG_PACKAGE_fuse-utils=y
CONFIG_PACKAGE_glib2=y
CONFIG_PACKAGE_kmod-block2mtd=y
CONFIG_PACKAGE_kmod-crypto-acompress=y
CONFIG_PACKAGE_kmod-crypto-aead=y
CONFIG_PACKAGE_kmod-crypto-crc32=y
CONFIG_PACKAGE_kmod-crypto-crc32c=y
CONFIG_PACKAGE_kmod-crypto-hash=y
CONFIG_PACKAGE_kmod-crypto-hmac=y
CONFIG_PACKAGE_kmod-crypto-manager=y
CONFIG_PACKAGE_kmod-crypto-null=y
CONFIG_PACKAGE_kmod-crypto-pcompress=y
CONFIG_PACKAGE_kmod-dax=y
CONFIG_PACKAGE_kmod-dm=y
CONFIG_PACKAGE_kmod-fs-autofs4=y
CONFIG_PACKAGE_kmod-fs-configfs=y
CONFIG_PACKAGE_kmod-fs-cramfs=y
CONFIG_PACKAGE_kmod-fs-exfat=y
CONFIG_PACKAGE_kmod-fs-exportfs=y
CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_kmod-fs-fscache=y
CONFIG_PACKAGE_kmod-fs-jfs=y
CONFIG_PACKAGE_kmod-fs-squashfs=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-fs-xfs=y
CONFIG_PACKAGE_kmod-fuse=y
CONFIG_PACKAGE_kmod-gpio-beeper=y
CONFIG_PACKAGE_kmod-gpio-dev=y
CONFIG_PACKAGE_kmod-i2c-algo-bit=y
CONFIG_PACKAGE_kmod-i2c-core=y
CONFIG_PACKAGE_kmod-i2c-gpio=y
CONFIG_PACKAGE_kmod-i2c-gpio-custom=y
CONFIG_PACKAGE_kmod-input-core=y
CONFIG_PACKAGE_kmod-leds-gpio=y
CONFIG_PACKAGE_kmod-ledtrig-default-on=y
CONFIG_PACKAGE_kmod-ledtrig-gpio=y
CONFIG_PACKAGE_kmod-ledtrig-heartbeat=y
CONFIG_PACKAGE_kmod-ledtrig-netdev=y
CONFIG_PACKAGE_kmod-ledtrig-oneshot=y
CONFIG_PACKAGE_kmod-ledtrig-timer=y
CONFIG_PACKAGE_kmod-ledtrig-transient=y
CONFIG_PACKAGE_kmod-lib-crc-itu-t=y
CONFIG_PACKAGE_kmod-lib-crc16=y
CONFIG_PACKAGE_kmod-lib-crc32c=y
CONFIG_PACKAGE_kmod-lib-crc7=y
CONFIG_PACKAGE_kmod-lib-lz4=y
CONFIG_PACKAGE_kmod-lib-lzo=y
CONFIG_PACKAGE_kmod-lib-zlib-inflate=y
CONFIG_PACKAGE_kmod-loop=y
CONFIG_PACKAGE_kmod-mmc=y
CONFIG_PACKAGE_kmod-mmc-spi=y
CONFIG_PACKAGE_kmod-mtd-rw=y
CONFIG_PACKAGE_kmod-mtdoops=y
CONFIG_PACKAGE_kmod-mtdram=y
CONFIG_PACKAGE_kmod-mtdtests=y
# CONFIG_PACKAGE_kmod-nf-ipt6 is not set
CONFIG_PACKAGE_kmod-nls-cp437=y
CONFIG_PACKAGE_kmod-nls-iso8859-1=y
CONFIG_PACKAGE_kmod-nls-utf8=y
CONFIG_PACKAGE_kmod-rfkill=y
CONFIG_PACKAGE_kmod-scsi-generic=y
CONFIG_PACKAGE_kmod-spi-bitbang=y
CONFIG_PACKAGE_kmod-spi-dev=y
CONFIG_PACKAGE_kmod-spi-gpio=y
CONFIG_PACKAGE_kmod-spi-gpio-custom=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-zram=y
CONFIG_PACKAGE_libattr=y
CONFIG_PACKAGE_libexpat=y
CONFIG_PACKAGE_libffi=y
CONFIG_PACKAGE_libfuse=y
CONFIG_PACKAGE_libgd=y
# CONFIG_PACKAGE_libip6tc is not set
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_libjpeg=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_liblzma=y
CONFIG_PACKAGE_libneon=y
CONFIG_PACKAGE_libnl=y
CONFIG_PACKAGE_libnl-core=y
CONFIG_PACKAGE_libnl-genl=y
CONFIG_PACKAGE_libnl-nf=y
CONFIG_PACKAGE_libnl-route=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libpng=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_libunrar=y
CONFIG_PACKAGE_libuuid=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-ntpc=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-app-vnstat=y
CONFIG_PACKAGE_luci-base=y
CONFIG_PACKAGE_luci-lib-ip=y
CONFIG_PACKAGE_luci-lib-json=y
CONFIG_PACKAGE_luci-lib-jsonc=y
CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-mod-failsafe=y
CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-rpc=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-proto-relay=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_ntpclient=y
CONFIG_PACKAGE_nvram=y
CONFIG_PACKAGE_relayd=y
CONFIG_PACKAGE_resolveip=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_snapshot-tool=y
CONFIG_PACKAGE_sshfs=y
CONFIG_PACKAGE_swap-utils=y
CONFIG_PACKAGE_ucert=y
CONFIG_PACKAGE_uclibcxx=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_vnstat=y
CONFIG_PACKAGE_vnstati=y
CONFIG_PACKAGE_wireless-tools=y
CONFIG_PACKAGE_wpa-cli=y
CONFIG_PACKAGE_wpad=y
# CONFIG_PACKAGE_wpad-basic is not set
CONFIG_PACKAGE_wpan-tools=y
CONFIG_PACKAGE_zlib=y
CONFIG_PACKAGE_zoneinfo-asia=y
CONFIG_PACKAGE_zoneinfo-core=y
CONFIG_PACKAGE_zram-swap=y
# CONFIG_SIGNED_PACKAGES is not set
CONFIG_STRIP_KERNEL_EXPORTS=y
CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA=y
CONFIG_TARGET_ROOTFS_INITRAMFS=y
CONFIG_USE_MKLIBS=y
CONFIG_USE_RFKILL=y
CONFIG_PACKAGE_openwrt-keyring=y

Unless it's really a AP147 devboard following the reference design exactly, you'll have to port OpenWrt to it like for any other hardware (I'd recommend to concentrate on the device tree based ath79, rather than the deprecated mach file based for that effort).

1 Like

AP147 is already supported by OpenWrt (ar71xx target). My point is not to redo the AP147, but to make sure the device actually boots on it (which it does not)

Does the "Kernel command line" (from fw_printenv) has any impact ?

On other deivces (openwrt based), I have console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd - and nothing else

Shall I change it ?

(Moved to the For Developers section.)

If I do sysupgrade, the device is not booting
Does "mtd -e firmware -r write xxx.bin firmware" have a better chance of working ?

Found the solution

@grosjo What you wrote there is what pepe2k suggested in the commit message.
I don't like that you provide an OpenWrt image without source-code.

The problem with these YunCore devices is that they expect the uImage after the rootfs partition which limits the kernel size to about 1.5 MB. That's why you have to modify the U-Boot environment bootcmd to also try to boot when the kernel is positioned before the squashfs image.

What would have been much cooler is if there isn't something like that already if we could flash these devices without such a workaround. We need to provide a factory firmware with a program at the position of the uImage of the stock firmware that jumps to the uImage at the beginning of the rootfs partition and then does the U-Boot environment variable modification, changes the partition layout to that of the sysupgrade file and resizes the jffs.

Edit: Or maybe just provide a python script that does what pepe2k suggested automatically.

no, the problem was that the supplier could not provide root password and there is NO UART on the PCB, and existing firmware was not giving access to /etc/shadow by the "backup" feature.

For the kernel after partition, is not the line below the solution ?

IMAGE/sysupgrade.bin := append-rootfs | pad-to 14528k | append-kernel | pad-to 16000k | check-size $$(IMAGE_SIZE)

Yes, that generates an image like the legacy AP147, but the problem is that only 1472k for the kernel remain. Their partition layout choice was stupid. In my case the kernel didn't fit. That's why pepe2k changes the bootcmd to support a different partition layout on OpenWrt. BTW I haven't investigated it yet, but the TFTP seems to be broken. Maybe you're interested in using pepe2k's U-Boot-Mod, too.

another element in teh discussion : the board (PCB) does not have any UART connectors

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.