Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 May 2017 21:58:24 +0100
From:      Mike Wolman <mike@wolman.co.uk>
To:        Aleksandr Rybalko <ray@ddteam.net>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: onion omega2+
Message-ID:  <e6d00135-da2d-fdfd-6c95-294949dc493b@wolman.co.uk>
In-Reply-To: <CAJ1Oi8G%2BvTMBX4Ey=H=2WruXDjXjcyte5_n8T3VDdL=h8m7%2BVw@mail.gmail.com>
References:  <694efc3a-e183-35a1-a0bf-9a9c0d708826@wolman.co.uk> <CAJ1Oi8G%2BvTMBX4Ey=H=2WruXDjXjcyte5_n8T3VDdL=h8m7%2BVw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

I am getting further - i think the build script for ralink doesnt 
extract the infomation properly for the loader and starting address:
https://github.com/freebsd/freebsd-wifi-build/blob/e3303a6e5ee13e096bdd3769e2e7e523fefb6f51/build/bin/build_ralink

I have now rebuilt the image files with:

UBOOT_KERN_LOADADDR="0x80001000" UBOOT_KERN_STARTADDR="0x80001100" 
X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT 
../freebsd-wifi-build/build/bin/build ralink mfsroot
UBOOT_KERN_LOADADDR="0x80001000" UBOOT_KERN_STARTADDR="0x80001100" 
X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT 
../freebsd-wifi-build/build/bin/build ralink fsimage
UBOOT_KERN_LOADADDR="0x80001000" UBOOT_KERN_STARTADDR="0x80001100" 
X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT 
../freebsd-wifi-build/build/bin/build ralink uboot


The U-Boot build image looks good:

[mike@f64-current ~/omega2/src]$ UBOOT_KERN_LOADADDR="0x80001000" 
UBOOT_KERN_STARTADDR="0x80001100" X_DTS_FILE=OMEGA2P.dts 
KERNCONF=MT7628_FDT ../freebsd-wifi-build/build/bin/build ralink uboot
Checking - uboot-mkimage-2010.12 .. OK.
Checking - lzma .. OK.
Checking - perl5 .. OK.
Checking - rsync .. OK.
Checking - mips-xtoolchain-gcc .. OK.
*** Configuration file  : ralink
*** Base configuration  : mipsel_ap
*** Platform            : mipsel_ap
Build list: uboot
*** Target              : uboot

LZMA 9.22 beta : Igor Pavlov : Public domain : 2011-04-18
Image Name:   FreeBSD
Created:      Mon May  8 21:35:02 2017
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    1365619 Bytes = 1333.61 kB = 1.30 MB
Load Address: 80001000
Entry Point:  80001100
*** Target Done.
*** Build Completed.



On the omega:



    ____       _             ____
   / __ \___  (_)__  ___    / __ \__ _  ___ ___ ____ _
  / /_/ / _ \/ / _ \/ _ \  / /_/ /  ' \/ -_) _ `/ _ `/
  \____/_//_/_/\___/_//_/  \____/_/_/_/\__/\_, /\_,_/
  W H A T  W I L L  Y O U  I N V E N T ? /___/"

Board: Onion Omega2 APSoC DRAM:  128 MB
relocate_code Pointer at: 87f60000
flash manufacture id: c2, device id 20 19
find flash: MX25L25635E
*** Warning - bad CRC, using default environment

============================================
Onion Omega2 UBoot Version: 4.3.0.3
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Oct 18 2016  Time:17:29:05
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
CPU freq = 575 MHZ
Estimated memory size = 128 Mbytes
Resetting MT7628 PHY.
Initializing MT7688 GPIO system.


**************************************
* Hold Reset button for more options *
**************************************


You have 40 seconds left to select a menu option...


Please select option:
    [ Enter ]: Boot Omega2.
    [ 0 ]: Start Web recovery mode.
    [ 1 ]: Start command line mode.
    [ 2 ]: Flash firmware from USB storage.

Option [1] selected.

1: System Enter Boot Command Line Interface.

U-Boot 1.1.3 (Oct 18 2016 - 17:29:05)
Omega2 # usb reset
(Re)start USB...
LOW LEVEL INIT USB0:
Scanning bus 0 for devices...
New Device 0
...
value 0x302 index 0x409 length 0xFF
usb_control_msg: status = success?
Manufacturer
Product      USB Flash Drive
SerialNumber 070B00012340350
Device is a hub?
2 USB Device(s) found
scan end
        Scanning bus for storage devices...

=================================================
1: Hub,  USB Revision 1.10
  -  OHCI Root Hub
  - Class: Hub
  - PacketSize: 8  Configurations: 1
  - Vendor: 0x0000  Product 0x0000 Version 0.0

=================================================
2: Mass Storage,  USB Revision 2.0
  -  USB Flash Drive 070B00012340350
  - Class: (from Interface) Mass Storage
  - PacketSize: 64  Configurations: 1
  - Vendor: 0x1005  Product 0xb113 Version 1.0
Testing BULK mode...Identifying a storage device...*
USB_STORAGE: 1 Storage Device(s) found
Omega2 # fatload usb 0:1 0x80001000 /kernel.MT7628_FDT.lzma.uImage
*
*
Reading file "/kernel.MT7628_FDT.lzma.uImage"
*
**
**
**
**
**
**
**
**
******
******************************************************************************** 
**********************************************
***********
*
FAT: 1365683 Bytes read
Omega2 # bootm 0x80001000
## Booting image at 80001000 ...
    Image Name:   FreeBSD
    Image Type:   MIPS Linux Kernel Image (lzma compressed)
    Data Size:    1365619 Bytes =  1.3 MB
    Load Address: 80001000
    Entry Point:  80001100
    Verifying Checksum ... OK
    Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to 
recover



At this point the board resets/reboots.

I have tried using the kernel.MT7628_FDT.lzma.flash instead but have the 
same LZMA Error.

I rebuilt before this post just in case there was an actual error with 
the files/usb mem key but still get the same problem.

Is there a different lzma format I should be using? (I have just let the 
build scripts create these).

Bit of info from file in case of use:

[mike@f64-current ~/omega2/tftpboot]$ file kernel.MT7628_FDT.lzma.uImage
kernel.MT7628_FDT.lzma.uImage: u-boot legacy uImage, FreeBSD, 
Linux/MIPS, OS Kernel Image (lzma), 1365619 bytes, Mon May  8 21:35:02 
2017, Load Address: 0x80001000, Entry Point: 0x80001100, Header CRC: 
0x47AD12EF, Data CRC: 0x64FCF0B6



On 08/05/2017 19:41, Aleksandr Rybalko wrote:
> Hi Mike!
>
> I see you have no "OK" after "Uncompressing Kernel Image ...", so 
> first point uboot decompressor fail.
> Why fail? Because you have wrong base address in image:
>   Load Address: fffffff2
>   Entry Point:  fffffff2
> MIPS32 machines have RAM mapped to 0x80000000 address, so adding its 
> size, you will get max address (if 16MB, it will be 0x81000000), but 
> you uboot image was created with 0xfffffff2.
>
> Even more, unpacked kernel expects it will be called at 0x80001100. so 
> if you have ELF kernel (file with ELF header, like every executable) 
> that file have to be loaded at (0x80001100 - ELF_HEADER_SIZE).
> In most cases it will be 0x80001100 - 0x100 = 0x80001000. But sometime 
> (I did not found why) it can be 0x20, you can find it by looking at 
> .text section in readelf -S.
>
> So if you have kernel with entry point 0x80001100 and .text segment 
> offset 0x100, you have to create uboot image with load address 
> 0x80001000 and entry point 0x80001100.
>
> If that step successful you will get:
> /Uncompressing Kernel Image/ ... OK
> Starting kernel ...
>
> Last line mean, uboot did jump into kernel code.
>
> Good luck.
>
> 2017-05-07 18:20 GMT+03:00 Mike Wolman <mike@wolman.co.uk 
> <mailto:mike@wolman.co.uk>>:
>
>     Hi,
>
>     I am trying to get FreeBSD working on this board - I think I am
>     almost there in getting it working but need some help please.
>
>     I have followed instructions from the freebsd-wifi-build and
>     *think* I have got everything correct - I am trying to do this on
>     a CURRENT setup:
>
>     FreeBSD f64-current.mw.office 12.0-CURRENT FreeBSD 12.0-CURRENT #0
>     r317887: Sun May  7 03:20:34 UTC 2017
>     mike@f64-current.mw.office:/usr/obj/usr/src/sys/GENERIC-NODEBUG amd64
>
>
>     $ cat ~/.freebsd-wifi-build-settings.cfg
>     X_SKIP_MORE_STUFF=YES
>     X_EXTRA_SRC_CONF=~/omega2/src.conf
>
>     $ cat ~/omega2/src.conf
>     WITHOUT_CLANG=YES
>     WITHOUT_CLANG_FULL=YES
>
>     get dts files from thread
>     http://community.onion.io/topic/1099/openwrt-on-the-omega-2/8
>     <http://community.onion.io/topic/1099/openwrt-on-the-omega-2/8>;
>
>
>     cd ~/omega2/src/sys/gnu/dts/mips
>     fetch
>     https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2.dtsi
>     <https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2.dtsi>;
>     fetch
>     https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2.dts
>     <https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2.dts>;
>     fetch
>     https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2P.dts
>     <https://raw.githubusercontent.com/WereCatf/source/image/target/linux/ramips/dts/OMEGA2P.dts>;
>
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink buildworld
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink buildkernel
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink installworld
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink installkernel
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink distribution
>
>
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink mfsroot
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink fsimage
>     X_DTS_FILE=OMEGA2P.dts KERNCONF=MT7628_FDT
>     ../freebsd-wifi-build/build/bin/build ralink uboot
>
>
>     Create flash:
>
>     X_FLASH=kernel.MT7628_FDT.lzma.flash
>     dd if=/dev/zero bs=$(( 0x200000 )) count=1 of=${X_FLASH}
>     dd if=kernel.MT7628_FDT.lzma.uImage of=${X_FLASH} conv=notrunc
>     dd if= mfsroot-ralink.img.lzma >> ${X_FLASH}
>
>
>     $ readelf -h kernel.MT7628_FDT | grep Entry
>       Entry point address:               0x80001100
>
>
>
>
>     Now on the omega over serial - I didnt get the network expansion
>     doc thing so am doing stuff with usb rather than tftp
>
>     I am not 100% sure about the 0x80001100 and the fatload and have
>     tried this
>
>     Omega2 # fatload usb 0:1 0x80001100 /kernel.MT7628_FDT.lzma.flash
>     *
>     *
>     Reading file "/kernel.MT7628_FDT.lzma.flash"
>     *
>     **
>     **
>     **
>     ******
>     *********************************************************************************************************************************************
>     ******
>     *
>     FAT: 2108463 Bytes read
>     Omega2 # bootm 0x80001100
>     ## Booting image at 80001100 ...
>        Image Name:   FreeBSD
>        Image Type:   MIPS Linux Kernel Image (lzma compressed)
>        Data Size:    1365122 Bytes =  1.3 MB
>        Load Address: fffffff2
>        Entry Point:  fffffff2
>        Verifying Checksum ... OK
>        Uncompressing Kernel Image ...
>
>
>     At this point nothing happens and console hangs - note in
>     OMEGA2.dtsithe console is set to ttyS0:
>
>     bootargs = "console=ttyS0,115200";
>
>
>
>
>     I have also tried with just kernel.MT7628_FDT and
>     kernel.MT7628_FDT.lzma but both fail:
>
>     Omega2 # fatload usb 0:1 0x80001100 /kernel.MT7628_FDT.lzma.uImage
>     *
>     *
>     Reading file "/kernel.MT7628_FDT.lzma.uImage"
>     *
>     **
>     **
>     ******
>     ******************************************************************************************************************************
>     **********
>     *
>     FAT: 1365186 Bytes read
>     Omega2 # bootm 0x80001100
>     ## Booting image at 80001100 ...
>        Image Name:   FreeBSD
>        Image Type:   MIPS Linux Kernel Image (lzma compressed)
>        Data Size:    1365122 Bytes =  1.3 MB
>        Load Address: fffffff2
>        Entry Point:  fffffff2
>        Verifying Checksum ... OK
>        Uncompressing Kernel Image ...
>
>
>     A few comments on the hardware for anyone who wants to get one:
>
>     Get the expansion dock with serial port access - the power dock
>     does not provide serial access - i think it is possible to use an
>     ftdi ttl serial chip/cable but have not tried.
>
>     Stupidly I forgot this only has wifi access so you are not able to
>     tftp boot this without getting the ethernet network expansion but
>     loading stuff up from a usb memory stick is seem fine from u-boot.
>
>     I do not think that it is possible to boot from the SD card on the
>     Omega2+ - which is a shame.
>
>     Thanks for reading,
>
>     Mike.
>
>
>
>     _______________________________________________
>     freebsd-mips@freebsd.org <mailto:freebsd-mips@freebsd.org> mailing
>     list
>     https://lists.freebsd.org/mailman/listinfo/freebsd-mips
>     <https://lists.freebsd.org/mailman/listinfo/freebsd-mips>;
>     To unsubscribe, send any mail to
>     "freebsd-mips-unsubscribe@freebsd.org
>     <mailto:freebsd-mips-unsubscribe@freebsd.org>"
>
>
>
>
> -- 
> WBW
> -------
> Rybalko Aleksandr <ray@ddteam.net <mailto:ray@ddteam.net>>
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e6d00135-da2d-fdfd-6c95-294949dc493b>