CuBox Development Platform

Linux, Android based tiny, energy efficient development machine
It is currently Thu May 23, 2013 7:20 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: uboot with ZFS
PostPosted: Fri May 04, 2012 9:02 am 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
I had success adding EXT4 to uboot, which got me looking at adding ZFS uboot support. But some things are new to me, so if there are others also interested then lets chat in here :)


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sun May 06, 2012 4:48 pm 
Offline
SolidRun Staff

Joined: Wed Dec 14, 2011 11:20 pm
Posts: 427
Can you provide patches?

_________________
SolidRun Engineering
user rabeeh in #cubox on Freenode IRC
Please visit and update the Wiki


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sun May 06, 2012 10:24 pm 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
Yes, its a fork of your github anyway, so I will just do pull-request when both works.


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Thu May 10, 2012 3:25 am 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
Ok I am done. Both EXT4 and ZFS works.

If people just want the binaries, they can be located here:

http://lundman.net/ftp/cubox/u-boot-cubox_hynix_cubox_zfs_ext4_spi.bin
http://lundman.net/ftp/cubox/u-boot-cubox_hynix_cubox_zfs_ext4_uart.bin

To try it out, download u-boot-cubox_hynix_cubox_zfs_ext4_spi.bin and put it on a USB stick, mine is ext2, but you can change to FAT if you want.

Reboot cubox and stop uboot from auto-booting, then enter:
Code:
usb start               
sf protect off
sf erase 0 0x00080000
if ext2load usb 0:1 0x00200000 u-boot-cubox_hynix_cubox_zfs_ext4_spi.bin; then sf write 0x00200000 0 0x00080000; fi               
resetenv
setenv mmc_started 0
setenv usb_started 0
setenv ide_started 0
setenv ipaddr 192.168.15.223
setenv serverip 192.168.15.100
saveenv
sf protect on


Change "usb start" and "usb" after ext2load, to "mmcinfo" and "mmc" if you use MMC instead of USB.
Change "ext2load" to "fatload" if you use FAT32 instead.

Rabeeh: Is it smart to have the "sf erase" outside of the "if ext2load" ? If it can't find the file, it has already erased the flash, no?

I am currently working on checking everything into github, should people prefer to build it themselves.


Code:
CuBox>> zfsls usb 0:2 /ROOT/@/
zfs reading label 0 at sector 0 (byte 0)
ZFS Pool GUID: 8349310002080761692 (73deb535d9a3c75c) Label: GUID: 1229383784885
2426185 (aa9c7c635319edc9), txg: 1348, SPA v28, ashift: 9

zfs endian set to little
ZPOOL label 'rpool'

zfs fsname = '/ROOT/' snapname='<NULL>' filename = '/'
<DIR>  lib
<DIR>  sbin
<DIR>  var
<DIR>  bin
<DIR>  dev
<DIR>  selinux
<DIR>  usr
<DIR>  root
<DIR>  home
<DIR>  srv
<DIR>  ttt
<DIR>  proc
<DIR>  tmp
<DIR>  mnt
<DIR>  etc
<DIR>  media
<DIR>  boot
<DIR>  opt
<DIR>  sys
<DIR>  .old-root
<DIR>  src
       rootfile.txt
<DIR>  rpool



CuBox>> zfsload usb 0:2 0x00200000 /ROOT/@/boot/uImage
Loading file "/ROOT/@/boot/uImage" from usb device 0:2 usbda2
zfs reading label 0 at sector 0 (byte 0)
...........
ZFS Pool GUID: 8349310002080761692 (73deb535d9a3c75c) Label: GUID: 12293837848852426185 (aa9c7c635319edc9), txg: 1348, SPA v28, ashift: 9
zfs endian set to little
zfs fsname = '/ROOT/' snapname='<NULL>' filename = '/boot/uImage'
3623192 bytes read

CuBox>> bootm
## Booting kernel from Legacy Image at 00200000 ...
   Image Name:   Linux-2.6.32.9-dove-5.4.2
   Created:      2012-01-07  10:23:53 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3623128 Bytes =  3.5 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

[    0.000000] Linux version 2.6.32.9-dove-5.4.2 (rabeeh@kossay-desktop) (gcc version 4.3.2 (sdk3.2rc1-ct-ng-1.4.1) ) #46 PREEMPT Sat Jan 7 12:23:38 IST 2012



Last edited by lundman on Sat May 12, 2012 6:12 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Thu May 10, 2012 5:35 am 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
The fork of CuBox u-boot:

https://github.com/lundman/u-boot

Just the EXT4 changes:

https://github.com/lundman/u-boot/compare/ext4

Just the ZFS changes:

https://github.com/lundman/u-boot/compare/zfs


Rabeeh: If you prefer, I can make a Pull Request back to you.


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sat May 12, 2012 5:03 am 
Offline

Joined: Wed Dec 28, 2011 5:05 am
Posts: 27
OK. I just tried this and here is my feedback.
your install instructions are wrong - you say usb reset but mmc load so I put the uboot file on my sdcard and it was installed fine

Code:
CuBox>> version

U-Boot 2009.08-dirty (May 10 2012 - 02:57:11) Marvell version: 5.4.4 NQ
CuBox>>


I then remade a SD card with only one partition containing a working setup of ubuntu but it did not load, so i got the sources and see that although you have added fs support you have not modified - board/marvell/mv_dove/mv_main.c where you will have to change the loop for fstype in ext2 fat; do to include ext4

Also I can report that u-boot was able to recognise my sata port multiplier

Code:
U-Boot 2009.08-dirty (May 10 2012 - 02:57:11) Marvell version: 5.4.4 NQ
CuBox>> ide reset

Reset IDE:
Marvell Serial ATA Adapter
Integrated Sata device found
Port Multiplier found @ 0 0. Vendor: 197b ports: 2
[0 0 0]: Enable DMA mode (6)
  Device 0 @ 0 0 0:
Model: WDC WD20EARS-19MVWB0                     Firm: 51.0AB51 Ser#:      WD-WCAZA4146802
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
[0 0 1]: Enable DMA mode (6)
  Device 1 @ 0 0 1:
Model: WDC WD20EARS-19MVWB0                     Firm: 51.0AB51 Ser#:      WD-WCAZA4102474
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)


although it will not list the data on the huge > 1TB volumes it was able to list the content of a smaller 4GB partition.

Can you post a revised build or should I follow the wiki instructions and build my own?


Another point I would like to ask about is that is it easy or possible to upgrade u-boot to the current 2012.04.1 since that has support for booting zImage and setting env from uEnv.txt and that is being used by the fedora team on other boards. Can someone give me any pointers on how to do that.

Ajay


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sat May 12, 2012 5:17 am 
Offline

Joined: Wed Dec 28, 2011 5:05 am
Posts: 27
another idea when you rework this -

Code:
CuBox>> setenv trydev "usb mmc ide"
CuBox>> for dev in $trydev; do echo $dev; done
usb
mmc
ide


you could have setenv trydev, tryparts, and tryfs and so you can control the triple nested loop some more, right now it is very difficult to edit the loop in the serial console to control the order of usb mmc ide or which fs to try since the line is huge and serial does not have any edit option.


Attachments:
File comment: patch to add control to u-boot
uboot.diff.gz [475 Bytes]
Downloaded 37 times
Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sat May 12, 2012 6:09 am 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
Hello ajayr!

Thanks for trying out the work. I did mix USB and MMC. I used MMC for my own testing, but figured people would use USBstick. I will amend my instructions.

I was unaware that it had a static loop in mv_main.c, since I always did manual loads. This seems to defeat the purpose of having a env bootscript somewhat. But thanks for your patch, I will go amend it.

We should probably try to fix the > 1TB limit in ext4load too, and I will try >1TB ZFS loads too (although, I know the GRUB version definitely supports it with the zpool sizes we have at work).

Finally, I was hoping to hear from Rabeeh what he wanted to do with regards to u-boot, and upgrading. Upgrading itself should not be too bad, I think we can get the majority done with a git pull from the real tree.


Edit:

I have replaced the binaries with the fixes, and checked the patch into github. (including 1 2)


Last edited by lundman on Sat May 12, 2012 6:43 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Sat May 12, 2012 6:28 am 
Offline

Joined: Wed Dec 28, 2011 5:05 am
Posts: 27
Thanks for your comments -

I just finished rebuilding here - I had to use the marvell toolchain somehow had errors building with the other 2 cross compilers here (codesourcery and fedora-16 gcc-4.7 cross). I can confirm that it works fine

Code:
CuBox
** LOADER **


U-Boot 2009.08-dirty (May 12 2012 - 11:15:16) Marvell version: 5.4.4 NQ

BootROM:
       Version on chip: 2.33
       Status: OK
       Retries #: 0
Board: CuBox
SoC:   88AP510 (A1)
CPU:   Marvell Sheeva (Rev 5)
       CPU @ 800Mhz, L2 @ 400Mhz
       DDR3 @ 400Mhz, TClock @ 166Mhz
PEX 0: interface detected no Link.
PEX 1: interface detected no Link.
DRAM:   1 GB
       CS 0: base 0x00000000 size 512 MB
       CS 1: base 0x20000000 size 512 MB
       Addresses 12M - 0M are saved for the U-Boot usage.
SF: Detected M25P32 with page size 64 kB, total  4 MB

Streaming disabled
L2 Cache Prefetch disabled
L2 Cache ECC disabled
Modifying CPU/CORE/DDR power rails to 1.0(-2.5%) / 1.0(-5%) / 1.5(-5%)
USB 0: Host Mode
USB 1: Host Mode
Setting VPU power OFF.
Setting GPU power ON.
MMC:   MV_SDHCI: 0, MV_SDHCI: 1
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0
===> Executing ext4load mmc 0:0 0x02000000 /boot.scr
Device: MV_SDHCI
Manufacturer ID: 1c
OEM: 5356
Name: USD   
Tran Speed: 25000000
Rd Block Len: 512
SD version 2.0
High Capacity: Yes
Capacity: 8017412096
Bus Width: 4-bit
Loading file "/boot.scr" from mmc device 0
Failed to mount ext2 filesystem...
** Bad ext4 partition or disk - mmc 0:0 **
===> Executing ext2load mmc 0:0 0x02000000 /boot.scr
Loading file "/boot.scr" from mmc device 0
Failed to mount ext2 filesystem...
** Bad ext2 partition or disk - mmc 0:0 **
===> Executing fatload mmc 0:0 0x02000000 /boot.scr
** Partition 0 not valid on device 0 **

** Unable to use mmc 0:0 for fatload **
===> Executing ext4load mmc 0:0 0x02000000 /boot/boot.scr
Loading file "/boot/boot.scr" from mmc device 0
Failed to mount ext2 filesystem...
** Bad ext4 partition or disk - mmc 0:0 **
===> Executing ext2load mmc 0:0 0x02000000 /boot/boot.scr
Loading file "/boot/boot.scr" from mmc device 0
Failed to mount ext2 filesystem...
** Bad ext2 partition or disk - mmc 0:0 **
===> Executing fatload mmc 0:0 0x02000000 /boot/boot.scr
** Partition 0 not valid on device 0 **

** Unable to use mmc 0:0 for fatload **
===> Executing ext4load mmc 0:1 0x02000000 /boot.scr
Loading file "/boot.scr" from mmc device 0:1 mmcda1
417 bytes read
## Executing script at 02000000
======== Setting bootargs ========
======== Loading initrd ========
Loading file "/uInitrd" from mmc device 0:1 (mmcda1)
3157357 bytes read
======== Loading kernel ========
Loading file "/uImage" from mmc device 0:1 (mmcda1)
2811408 bytes read
======== Booting kernel ========
## Booting kernel from Legacy Image at 16000000 ...
   Image Name:   Linux-3.3.4
   Created:      2012-05-01   5:45:04 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2811344 Bytes =  2.7 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 18000000 ...
   Image Name:   ramdisk
   Created:      2012-05-05  13:12:37 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    3157293 Bytes =  3 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
m25p80 spi0.0: unrecognized JEDEC id 20ba16

Ubuntu 12.04 LTS cubox console

cubox login:



this shows that the defaults of partition 0 1 is wrong it needs to be 1 2, easy to fix for me.


Top
 Profile  
 
 Post subject: Re: uboot with ZFS
PostPosted: Mon May 14, 2012 2:31 am 
Offline

Joined: Mon Mar 05, 2012 6:06 am
Posts: 82
Ok the EXT4 code calls the dev.c code using just "int" for sector, and at 512byte, it can only address exactly 1TB before it goes negative.

I have no way to test this today, but if I change the code to the u-boot default "unsigned long" I think we can make it work up to 2TB. After that, we need to change some core structures of u-boot. The partition_struct and block_read functions both need to go from "unsigned long" to "uint64_t".

I have updated my binaries in anticipation of testing them tomorrow. I also took out ZFS of the default "tryfs" as it can crash on non-ZFS filesystems. Better error checking needed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group