Making Picostation m2HP work

hiren panchasara hiren.panchasara at gmail.com
Mon Aug 26 22:04:17 UTC 2013


On Mon, Aug 26, 2013 at 2:24 PM, hiren panchasara <
hiren.panchasara at gmail.com> wrote:

>
>
>
> On Thu, Aug 22, 2013 at 12:20 AM, hiren panchasara <
> hiren.panchasara at gmail.com> wrote:
>
>>
>>
>>
>> On Wed, Aug 21, 2013 at 10:02 PM, Adrian Chadd <adrian at freebsd.org>wrote:
>>
>>> Right! Nice work!
>>>
>>> So that tells me that whatever image you've stuffed into the ubiquiti
>>> firmware isn't setup right. Did you lzma compress the kernel, then wrap
>>> that in mkimage or whatever the u-boot command is, and then pass _that_
>>> output to the ubiquiti firmware builder?
>>>
>>
>> Alright, so as Adrian suggested, I tried to create uboot'ed kernel by
>> running:
>>
>>  "# ../build/build/bin/build ap91 uboot"
>>
>> which basically runs build_uboot which does following:
>>
>> /usr/local/bin/lzma e ${X_KERNEL} /tftpboot/kernel.${KERNCONF}.lzma ||
>> exit 1
>>
>> # Create the firmware
>> mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C lzma \
>>   -a ${UBOOT_KERN_LOADADDR} -e ${UBOOT_KERN_STARTADDR} \
>>   -n "FreeBSD" -d /tftpboot/kernel.${KERNCONF}.lzma \
>>   /tftpboot/kernel.${KERNCONF}.lzma.uImage \
>>   || exit 1
>>
>> Now, I had to install /usr/ports/devel/uboot-mkimage/ port to get
>> "mkimage" binary referenced above.
>>
>> But as soon as I run "# ../build/build/bin/build ap91 uboot", the laptop
>> deadlocks. I have to hard reboot the laptop. I tried it 2 times and it
>> stops right when its trying to execute mkimage command listed above.
>>
>> I am not sure what is the reason behind that. And I see ray@ is the
>> maintainer of that port so I am cc'ing him to get some insights too.
>>
>
> That was some issue on my laptop. Trying on another laptop worked.
>
> I generated final image with kernel.AP91.lzma.uImage inside it instead of
> plain kernel.gz
>
> This is what I am getting now (instead of "bad magic number"):
>
>
>
> U-Boot 1.1.4.2-s594 (Dec  5 2012 - 15:23:07)
>
> Board: Ubiquiti Networks XM board (rev 1.0 e302)
> DRAM:  32 MB
> Flash:  8 MB
> PCIe WLAN Module found (#1).
> Net:   eth0, eth1
> Hit any key to stop autoboot:  0
> ## Booting image at 9f050000 ...
>    Image Name:   FreeBSD
>    Created:      2013-08-24  15:28:06 UTC
>
>    Image Type:   MIPS Linux Kernel Image (lzma compressed)
>    Data Size:    131085 Bytes = 128 kB
>    Load Address: 80050000
>    Entry Point:  80050100
>    Verifying Checksum ... OK
>    Uncompressing Kernel Image ... ERROR, LzmaDecode.c, 332
>
> Decoding error = 1
> LZMA ERROR 1 - must RESET board to recover
>
> Resetting...
>
> Trying to figure out what this means.
>

Wohoooo...

ray@ is the man!!!

He has some hacked up version of lzma at  http://zrouter.org/hg/zrouter/

and using that lzma for compression, I finally was able to boot:



> U-Boot 1.1.4.2-s594 (Dec  5 2012 - 15:23:07)

Board: Ubiquiti Networks XM board (rev 1.0 e302)
DRAM:  32 MB
Flash:  8 MB
PCIe WLAN Module found (#1).
Net:   eth0, eth1
Hit any key to stop autoboot:  0
ar7240> rescu
Unknown command 'rescu' - try 'help'
ar7240> uresc
Setting default IP 192.168.1.20
Starting TFTP server...
Using eth0 (192.168.1.20), address: 0x81000000
Waiting for connection: \
Receiving file from 192.168.1.254:57971
Received 5917237 bytes
Firmware Version: XS2.ar7240.FreeBSD
Setting U-Boot environment variables
Un-Protected 1 sectors
Erasing Flash.... done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
Copying partition 'kernel' to flash memory:
        erasing range 0x9F050000..0x9F12FFFF: .............. done
Erased 14 sectors
        writing to address 0x9f050000, length 0x000e0000 ...
Copying partition 'rootfs' to flash memory:
        erasing range 0x9F130000..0x9F5FFFFF:
.............................................................................
done
Erased 77 sectors
        writing to address 0x9f130000, length 0x004d0000 ...

Firmware update complete.

Resetting...

U-Boot 1.1.4.2-s594 (Dec  5 2012 - 15:23:07)

Board: Ubiquiti Networks XM board (rev 1.0 e302)
DRAM:  32 MB
Flash:  8 MB
PCIe WLAN Module found (#1).
Net:   eth0, eth1
Hit any key to stop autoboot:  0
## Booting image at 9f050000 ...
   Image Name:   FreeBSD
   Created:      2013-08-26  14:51:52 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    893021 Bytes = 872.1 kB
   Load Address: 80050000
   Entry Point:  80050100
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

CPU platform: Atheros AR7241 rev 1
CPU Frequency=390 MHz
CPU DDR Frequency=390 MHz
CPU AHB Frequency=195 MHz
platform frequency: 390000000
CPU reference clock: 5 MHz
arguments:
  a0 = 00000006
  a1 = a1f4bfb0
  a2 = a1f4c450
  a3 = 00000000
Cmd line:argv is invalid
Environment:
envp is invalid
Cache info:
  picache_stride    = 4096
  picache_loopcount = 16
  pdcache_stride    = 4096
  pdcache_loopcount = 8
cpu0: MIPS Technologies processor v116.147
  MMU: Standard TLB, 16 entries
  L1 i-cache: 4 ways of 512 sets, 32 bytes per line
  L1 d-cache: 4 ways of 256 sets, 32 bytes per line
  Config1=0x9ee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config3=0x20
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #0 r254676: Thu Aug 22 18:05:52 UTC 2013
    hirenp at catchbone-l7.corp.yahoo.com:/usr/home/hirenp/work/freebsd/head/obj/mipseb/mips.mips/usr/home/hirenp/work/freebsd/head/src/sys/AP91
mips
gcc version 4.2.1 20070831 patched [FreeBSD]
real memory  = 16777216 (16384K bytes)
avail memory = 12087296 (11MB)
random device not loaded; using insecure entropy
nexus0: <MIPS32 root nexus>
nexus0: failed to add child: arge0
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 195000000 Hz quality 800
Event timer "MIPS32" frequency 195000000 Hz quality 800
argemdio0: <Atheros AR71xx built-in ethernet interface, MDIO controller> at
mem 0x19000000-0x19000fff on nexus0
mdio0: <MDIO> on argemdio0
mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
arswitch0: <Atheros AR7240 Ethernet Switch> on mdio0
arswitch0: attaching PHY 0 failed
arswitch0: attaching PHY 1 failed
arswitch0: attaching PHY 2 failed
arswitch0: attaching PHY 3 failed
device_attach: arswitch0 attach returned 6
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> on apb0
uart0: console (115200,n,8,1)
pcib0 at irq 0 on nexus0
pcib0: found EEPROM at 0x1fff1000 on 0.0.0
pcib0: EEPROM firmware: 0x1fff1000 @ 4096 bytes
pcib0: device EEPROM 'pcib.0.bus.0.0.0.eeprom_firmware' registered
pci0: <PCI bus> on pcib0
pci0: <network> at device 0.0 (no driver attached)
arge0: <Atheros AR71xx built-in ethernet interface> at mem
0x19000000-0x19000fff irq 2 on nexus0
miiproxy0: <MII/MDIO proxy, MII side> on arge0
arge0: can't attach proxy
arge0: finishing attachment, phymask 0010, proxy null
arge0: unable to attach PHY 4: 6
device_attach: arge0 attach returned 6
arge1: <Atheros AR71xx built-in ethernet interface> at mem
0x1a000000-0x1a000fff irq 3 on nexus0
arge1: finishing attachment, phymask 0000, proxy null
arge1: Ethernet address: 62:73:64:dd:03:41
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: w25q64, sector 65536 bytes, 128 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
ar71xx_wdog0: Previous reset was due to watchdog timeout
Timecounters tick every 1.000 msec
Trying to mount root from ufs:/dev/map/rootfs.uncompress []...
mountroot: waiting for device /dev/map/rootfs.uncompress ...
Mounting from ufs:/dev/map/rootfs.uncompress failed with error 19.

Loader variables:

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:tank
        cd9660:/dev/acd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot>


Now,  will look into why "Mounting from ufs:/dev/map/rootfs.uncompress
failed with error 19."

cheers,
Hiren


More information about the freebsd-embedded mailing list