Debian on NAND using BSP and or LiveSuit

Started by aquarat, June 22, 2013, 12:14:09 AM

Previous topic - Next topic

aquarat

Hi

I went through the BSP nand compilation process on this page : http://linux-sunxi.org/BSP

I have a .img file in the output directory and everything completed without error (I had to install ia32-libs the first time round).

I got LiveSuit on Ubuntu x64 to flash the image, but it doesn't boot. I can mount the partitions on the nand in debian running off an SD card. I've checked the serial console and there's no output when the sd card is removed.

I've tried using both a linaro rootfs and a rootfs created from a working SD card.

Any advice would be great :P .

-edit-

I've tried both the BSP guide and I've also tried this : https://github.com/hehopmajieh/olinuxino_nand .

I've tried flashing all the images so far using LiveSuit under Windows 7 x64, LiveSuit under Windows XP x32, LiveSuit under Ubuntu x64 and PhoenixSuit on Win 7 x64... none of the images work in any of the applications.

I've also tried dd'ing the images directly to the nand using a debian SD card.


oldpenguin

Hello
Do you have UART1 port connected ?
Can you see any messages ?
You should see at least the boot loader + u-boot messages.
When flashing you should also see a lot of debug comming from the serial port.

Regards

António

aquarat

Hi

If I boot off an SD card then yes, there is a lot of output on the UEXT UART. It's U-boot and then Linux messages.

If I write any of the images I've generated to the nand using dd then there is no debug output. If I write android to the nand using LiveSuit then there's debug output.

Some something is wrong with the images generated with the Sunxi BSP and hehop methods.

I'm not sure if LiveSuit checks that far but perhaps the rootfs is the problem. My second rootfs is 1.7 GB in size. The Linaro rootfs is 54MB in size.

Also, the Linaro rootfs has "binary" as the first folder in the archive... does HeHop's script expect the rootfs to start with binary ? (should the rootfs folder contain /dev /etc or should it contain "binary" and then inside binary is /dev /etc /root)

One user on the xda developer forums and the Cubie forums said that LiveSuit doesn't support Linux images.
http://forum.xda-developers.com/showthread.php?t=2129609
http://www.cubieforums.com/index.php?topic=63.10

A lot of people want Debian on the NAND... if I get this working I'll host an image for anyone to use on Google Drive.


oldpenguin

Well...
While at the sunxi-bsp directory, I usually do:
make clean (optional)
./configure a13_olinuxino (optional)
make (optional)
make linux-config (change configuration)
make linux
make hwpack

(I have to copy the manually to the rootfs.ext4 file-system)
make livesuit ROOTFS=rootfs.ext4
The generated image goes to
sunxi-bsp/output/a13_olinuxino_livesuit.img

Of course I forgot to mention that I have a file with rootfs.ext4 and sunxi-bsp level.

Then I flash with Livesuit on Windows XP
When I boot, I see the first bootloader messages, then u-boot messages, then the kernel booting from nand.

Regards

António

aquarat

!!! Thanks oldpenguin, this is very useful.

I didn't execute "make hwpack" and for the ROOTFS arg I specified a .tar.gz file.

When you say you had to copy manually, you had to copy the output from hwpack to the rootfs ? Can you give an example command ? Just so I don't get it wrong.

Did you download your rootfs or did you generate it yourself ?

Thanks!

oldpenguin

Sorry.
What I meant is that you have to manually copy the lib/modules directory to the ext4 file-system.
I have a script like this:
#!/bin/bash
echo Creating tmp
mkdir tmp
echo mounting rootfs.ext4
sudo mount -o loop rootfs.ext4 tmp
echo expanding hwpack
mkdir hwpacktmp
cd hwpacktmp
tar -xaf ../output/a13_olinuxino_hwpack.tar.xz
cd ../tmp
echo Copy from hwpack to rootfs
sudo cp -R ../hwpacktmp/rootfs/* .
sync
cd ..
echo Unmounting rootfs
sudo umount tmp
sleep 1
echo Cleaning up
rmdir tmp
rm -Rf hwpacktmp


My rootfs.ext4 is based on the Linaro file-system.
But there is one caveat, that you might already have noticed...The Linaro image has only 374M.
To be more useful is has to be expanded.
More on next post...

Regards

António

aquarat

That is so cool! Thanks oldpenguin... trying now.

oldpenguin

Hello again

To expand the Linaro file-system you can do something like this:

You have the original file-system called for example linaro_rootfs.ext4

dd if=/dev/zero of=rootfs.ext4 bs=1M count=ZZZZ
sudo mkfs.ext4 rootfs.ext4
mkdir old
mkdir new
sudo mount -o loop rootfs.ext4 new
sudo mount -o loop linaro_rootfs.ext4 old
cd new
sudo cp -R ../old/* .
sudo chmod a+w tmp
cp -R ../build/a13_olinuxino_hwpack/rootfs/* .
cd ..
ls -l new
sudo umount new
sudo umount old
rmdir new
rmdir old


And there you have your larger file-system in rootfs.ext4

You can play with ZZZZ value, up to maybe 1400 (size im MB).

Regards

António


aquarat

#8
Hey oldpenguin

Everything runs without error until LiveSuit on Ubuntu gives an error at the end of the flash process : "Failed to flash firmware: pcall FAILED Tools_ii.lua:2887: attempt to index hwSCanData (a nil value) 2 275"

LiveSuit under XP 32 gives an error dialog with no text. Neither LS on Ubuntu or XP generate any debugging output on the serial line.


This is the process I followed :
make clean
./configure a13_olinuxino
make
make linux-config
make linux
make hwpack
dd if=/dev/zero bs=1M count=1000 of=rootfs.ext4
mkfs.ext4 rootfs.ext4
mkdir tmp
mount -o loop rootfs.ext4 tmp
tar -xvf linaro-quantal-nano-20130422-342.tar.gz #THIS FILE is 54MB in size
mv binary/* tmp/
sync
umount tmp
rmdir tmp
Run oldpenguin's script* to put hwpack in rootfs image.

At this point the image's root looks like this :
bin  boot  dev  etc  home  lib  lost+found  media  mnt  opt  proc  root  run  sbin  selinux  SHA256SUMS  srv  sys  tmp  usr  var

make livesuit ROOTFS=rootfs.ext4

I then flash the resultant image (1GB in size) to the a13.

On the serial console, if I try flashing with LiveSuit I don't see anything... if I try using PhoenixSuit I get this :
[FES]:                                                                                                 
[FES]:=================================================================================================
[FES]:=                                                                                               =
[FES]:=                                         EEMMMMMMLL                                            =
[FES]:=                                     ::MMMHOLIGANEE                                            =
[FES]:=                                   ::MM.                                                       =
[FES]:=                                   MMFF                                                        =
[FES]:=                                 FFMM                                                          =
[FES]:=                                MMMM                                                           =
[FES]:=                              ..MMFF                                                           =
[FES]:=                              EEMM.                                           FFMMMM           =
[FES]:=          . MMMMMMMM    MMMMMMMMMMMMMMMMMM      FFMMMMMM::      ::MMMM      BBMMMMFF           =
[FES]:=        ::MM  . MMMM          MMMM            MM.   MMMMMM    EE..EEMM::  EE::                 =
[FES]:=        MM      MMMM        ::MMLL          EEMM    MMMMFF  .       MMMM::::                   =
[FES]:=      MMMM    FFMMI         BBMM            MMI     MMMM            MMMMEE                     =
[FES]:=      MMMM  . MM::          MMMM          MMMM    BBMM              MMMM                       =
[FES]:=    BBMMFF::EE              MMMM          MMMM  MM::                BBMM..                     =
[FES]:=    MMMMEE                I MMI         I MMMM::                  ::FFMMFF                     =
[FES]:=    MMMM          LL      MMMM          EEMMMM        LL          BB  MMMM                     =
[FES]:=    MMMM      I MM        MMMM          MMMMMM      MM::        MM    MMMM                     =
[FES]:=    MMMMMMMMMMEE          MMMM          .GUANLI@HUANG.   BB    BB      FFMM.                   =
[FES]:=      MMMMMM..          I MMI             MMMMMMEE      MMMMMM          MMEE                   =
[FES]:=                        MMMM                                            MMMM                   =
[FES]:=                        MMMM                                            ::MM::                 =
[FES]:=                        MM                                                BBMM        MM       =
[FES]:=                      EEBB                                                  BBMM..  MMMM       =
[FES]:=                      MM                                                      ..EEMMFF         =
[FES]:=          MMMMMMMMMMMM                                                                         =
[FES]:=          MMMMMMMMI                                                                            =
[FES]:=                                                                                               =
[FES]:=================================================================================================
[FES]:                                                                                                 
[FES]:INFO : ......1........
[FES]:INFO : ......2........
[FES]:INFO : ......3........
[FES]:INFO : ......4........
[FES]:INFO : ......5........
[FES]:INFO : ......6........
[FES]:INFO : ......7........
[FES]:INFO : ......8........
[FES]:INFO : ......9........
[FES]:CONFIG_USB_GADGET_DUALSPEED
[FES]:fes connect to host
[FES]:INFO : ......10.......
[FES]:jump to fes_main
[FES]:INFO: fes_protocol_process start
[FES]:[info]: set address 6

PhoenixSuit complains of a timeout.




oldpenguin

Hello aquarat

I've never used PhoenixSuit but I guess it is similar to LiveSuit.

This is what I get when flashing:
[FES]:                                                                                                 
[FES]:=================================================================================================
[FES]:=                                                                                               =
[FES]:=                                         EEMMMMMMLL                                            =
[FES]:=                                     ::MMMHOLIGANEE                                            =
[FES]:=                                   ::MM.                                                       =
[FES]:=                                   MMFF                                                        =
[FES]:=                                 FFMM                                                          =
[FES]:=                                MMMM                                                           =
[FES]:=                              ..MMFF                                                           =
[FES]:=                              EEMM.                                           FFMMMM           =
[FES]:=          . MMMMMMMM    MMMMMMMMMMMMMMMMMM      FFMMMMMM::      ::MMMM      BBMMMMFF           =
[FES]:=        ::MM  . MMMM          MMMM            MM.   MMMMMM    EE..EEMM::  EE::                 =
[FES]:=        MM      MMMM        ::MMLL          EEMM    MMMMFF  .       MMMM::::                   =
[FES]:=      MMMM    FFMMI         BBMM            MMI     MMMM            MMMMEE                     =
[FES]:=      MMMM  . MM::          MMMM          MMMM    BBMM              MMMM                       =
[FES]:=    BBMMFF::EE              MMMM          MMMM  MM::                BBMM..                     =
[FES]:=    MMMMEE                I MMI         I MMMM::                  ::FFMMFF                     =
[FES]:=    MMMM          LL      MMMM          EEMMMM        LL          BB  MMMM                     =
[FES]:=    MMMM      I MM        MMMM          MMMMMM      MM::        MM    MMMM                     =
[FES]:=    MMMMMMMMMMEE          MMMM          .GUANLI@HUANG.   BB    BB      FFMM.                   =
[FES]:=      MMMMMM..          I MMI             MMMMMMEE      MMMMMM          MMEE                   =
[FES]:=                        MMMM                                            MMMM                   =
[FES]:=                        MMMM                                            ::MM::                 =
[FES]:=                        MM                                                BBMM        MM       =
[FES]:=                      EEBB                                                  BBMM..  MMMM       =
[FES]:=                      MM                                                      ..EEMMFF         =
[FES]:=          MMMMMMMMMMMM                                                                         =
[FES]:=          MMMMMMMMI                                                                            =
[FES]:=                                                                                               =
[FES]:=================================================================================================
[FES]:                                                                                                 
[FES]:INFO : ......1........
[FES]:INFO : ......2........
[FES]:INFO : ......3........
[FES]:INFO : ......4........
[FES]:INFO : ......5........
[FES]:INFO : ......6........
[FES]:INFO : ......7........
[FES]:INFO : ......8........
[FES]:INFO : ......9........
[FES]:CONFIG_USB_GADGET_DUALSPEED
[FES]:fes connect to host
[FES]:INFO : ......10.......
[FES]:jump to fes_main
[FES]:INFO: fes_protocol_process start
[FES]:[info]: set address 1
[FES]:write special pipe
[FES]:INFO: fed reg_addr = 0x401164f0
[FES]:fed para[0] = 0x40900000
[FES]:fed para[1] = 0x40901000
[FES]:fed para[2] = 0x00000000
[FES]:fed para[3] = 0x00000000
[Fed]:-------------------------------------------------
[Fed]:                Hello, Nand Register             
[Fed]:-------------------------------------------------
[Fed]:"private" part NOT configured.
NHW : start nand scan
[NAND] nand driver version: 0x0x00000002, 0x0x00000010, data: 0x20120610
NAND_RequestDMA  ok
NFC Randomizer start.
[SCAN_DBG] Nand flash chip id is:0x0x000000ad 0x0x000000d7 0x0x00000094 0x0x00000000 0x0x401074ac 0x0x000000da
NFC Read Retry Init.
PHY_SetDefaultParam: chip 0x0x00000000, Read Retry Default Value is 0x0x00000021, 0x0x00000021, 0x0x00000000, 0x0x40106a18


[SCAN_DBG] ==============Nand Architecture Parameter==============
[SCAN_DBG]    Nand Chip ID:         0x0xda94d7ad 0x0xffffffff
[SCAN_DBG]    Nand Chip Count:      0x0x00000001
[SCAN_DBG]    Nand Chip Connect:    0x0x00000001
[SCAN_DBG]    Nand Rb Connect Mode:      0x0x00000001
[SCAN_DBG]    Sector Count Of Page: 0x0x00000010
[SCAN_DBG]    Page Count Of Block:  0x0x00000100
[SCAN_DBG]    Block Count Of Die:   0x0x00000800
[SCAN_DBG]    Plane Count Of Die:   0x0x00000002
[SCAN_DBG]    Die Count Of Chip:    0x0x00000001
[SCAN_DBG]    Bank Count Of Chip:   0x0x00000001
[SCAN_DBG]    Optional Operation:   0x0x00000188
[SCAN_DBG]    Access Frequence:     0x0x0000001e
[SCAN_DBG]    ECC Mode:             0x0x00000003
[SCAN_DBG]    Read Retry Type:      0x0x00010604
[SCAN_DBG]    DDR Type:             0x0x00000000
[SCAN_DBG] =======================================================

[SCAN_DBG] ==============Optional Operaion Parameter==============
[SCAN_DBG]    MultiPlaneReadCmd:      0x0x00000060, 0x0x00000060
[SCAN_DBG]    MultiPlaneWriteCmd:     0x0x00000011, 0x0x00000081
[SCAN_DBG]    MultiPlaneCopyReadCmd:  0x0x00000060, 0x0x00000060, 0x0x00000035
[SCAN_DBG]    MultiPlaneCopyWriteCmd: 0x0x00000085, 0x0x00000011, 0x0x00000081
[SCAN_DBG]    MultiPlaneStatusCmd:    0x0x00000070
[SCAN_DBG]    InterBnk0StatusCmd:     0x0x000000f1
[SCAN_DBG]    InterBnk1StatusCmd:     0x0x000000f2
[SCAN_DBG]    BadBlockFlagPosition:   0x0x00000002
[SCAN_DBG]    MultiPlaneBlockOffset:  0x0x00000001
[SCAN_DBG] =======================================================
NHW : nand hw scan ok
check nand version start.
Current nand driver version is 0x000000ff 0x00000000 0x00000002 0x00000010
Succeed in getting flash info.
block 0 is cleared block.
block 1 is cleared block.
block 2 is bad block.
block 3 is bad block.
can't find valid version info in boot blocks.
VersionCheck end.
[Fed]:To erase boot0 blocks.
Ready to erase boot blocks.
has cleared the boot blocks.
[Fed]:L253,To erase nand.
Ready to erase chip.
nfb phy init ok.
Succeed in getting flash info.
page size:0x00002000, oob_size: 0x00000020, block size: 0x00000100, bad block position: 0x00000002.
chip_cnt = 0x00000001, chip_connect = 0x00000001, rb_cnt = 0x00000001,  rb_connect = 0x00000001,  good_block_ratio =0x000003b6
erase chip 0
has cleared the chip.
the nand is OK.
Ready to scan bad blocks.
nfb phy init ok.
Succeed in getting flash info.
scan CE 0
0 bad blocks in CE 0
cal bad block num is 0
cal good block num is 1004
good block ratio is 950
[Fed]:get the good blk ratio after hwscan : 950
[Fed]:erase=1, hasPrivatePart=0.
[Fed]:nand logic size [0x00000000, 0x0076c000]Sec.
[Fed]:Dram size is 512
[Fed]:-------------------------------------------------
[Fed]:               Byebye, Nand Register.           
[Fed]:-------------------------------------------------
[FES]:INFO : run addr = 0x00000000 , type = 1437204482


It goes on. When finished, the board boots from flash.

In your case, it looks like LiveSuit is not communicating properly with the board.
I think you have to check if the Win drivers are correctly installed.


aquarat

Oldpenguin, that's strange. The drivers in Windows are :

Date : 2013/01/24
Version : 1.0.0.1
Signer : Allwinner Technology Co.,Ltd.

PhoenixSuit is the flasher recommended for CubieBoards.

The board doesn't show any debugging output regardless of whether I'm trying to flash it with LiveSuit in Win XP, Win7 or Ubuntu. LiveSuit in Ubuntu tries to flash the image but fails after some time with the error above.

I start the flash procedure by unplugging everything except the serial console.
I then hold down the "Home" button.
I then plug in the USB cable and then
plug in the power cable and then I
release the Home button.

Does that sound right ?

oldpenguin

Yes that's what I do.

I usually start Livesuit beforehand, and put it in foreground because it always minimizes itself to the taskbar after starting.

Then after a few seconds Livesuit detects the board and that's when the [FES] messages start to appear.
In your case it seems that LiveSuit is not detecting the board.

I would try reinstalling the software plus drivers. I downloaded mine from this link https://docs.google.com/file/d/0B7WHuNCASY8cWlZ2djh4X0QtV0U/edit?usp=sharing (from https://www.olimex.com/wiki/A13-OLinuXino page). I think it's version 1.02.
Maybe you should try with another machine if you have one available.
I have never tested this with a virtual machine, but my guess is that the usb driver wont probably work.

aquarat

#12
The version you linked to is v1.09, which is later than mine and it flashes the images.

aquarat

#13
So now it flashes correctly but this happens on boot :

dram size =512
0xffffffff,0xffffffff
super_standby_flag = 0
HELLO! BOOT0 is starting!
boot0 version : 1.6.0
Succeed in opening nand flash.
Succeed in reading Boot1 file head.
The size of Boot1 is 0x00064000.
The file stored in 0X00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.149] boot1 version : 1.7.0
[       0.149] pmu type = 3
[       0.151] bat vol = 1437
[       0.183] axi:ahb:apb=3:2:2
[       0.183] set dcdc2=1400, clock=1008 successed
[       0.185] key
[       0.197] no key found
[       0.197] flash init start
[       0.246] flash init finish
[       0.246] fs init ok
[       0.247] fattype FAT16
[       0.248] fs mount ok
[       0.254] script finish
[       0.255] power finish
[       0.265] BootMain start
[       0.265] 0
[       0.295] init to usb pc
[       0.320] power_start=0x00000002
[       0.320] power trigger
[       0.320] startup status = 0
[       0.338] parser bmp file c:\os_show\bat0.bmp failed
[       1.839] no battery exist
[       1.839] key value = 1
[       1.839] recovery key high 6, low 4
[       1.843] unable to find fastboot_key key_max value
[       1.862] unable to open script file c:\linux\linux.ini
[       1.862] NO OS to Boot
[       1.869] try to fel in 1 secend

Thanks for all your help so far oldpenguin.

-edit-
I've also discovered that you don't need to remove the USB and power every time you flash the device. You can flash the device with power and USB connected by just holding in the home button, pressing reset and then releasing the home button two seconds later.

-edit2-
No matter what image I flash, none of them boot. I've tried images generated with HeHop's build.sh and the normal sunxi BSP (make livesuit ROOTFS=) commands. I've tried both the Linaro Nano rootfs and the rootfs on an SD card that boots. Any ideas ?

I must admit I'm surprised how difficult it is to get Debian booting off the NAND... unless I'm just having bad luck :P .

oldpenguin

Yeah...
I wish someone with more knowledge on these boot loaders could help us a bit...
Anyway, I compared your startup messages with one from my board:

dram size =512
0x7ffffade,0xf56f67fe
super_standby_flag = 0
HELLO! BOOT0 is starting!
boot0 version : 1.5.0
Succeed in opening nand flash.
Succeed in reading Boot1 file head.
The size of Boot1 is 0x00036000.
The file stored in 0X00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.082] boot1 version : 1.4.0
[       0.082] pmu type = 3
[       0.084] bat vol = 1608
[       0.110] axi:ahb:apb=3:2:2
[       0.110] set dcdc2=1400, clock=1008 successed
[       0.112] key
[       0.125] no key found
[       0.125] flash init start
[       0.167] flash init finish
[       0.169] fs init ok
[       0.170] fattype FAT16
[       0.170] fs mount ok
[       0.175] script finish
[       0.176] power finish
[       0.182] BootMain start
[       0.182] 0
[       0.211] init to usb pc
[       0.224] power_start=0x00000002
[       0.224] power trigger
[       0.225] startup status = 0
[       2.314] no battery exist
[       2.314] key value = 1
[       2.314] recovery key high 6, low 4
[       2.318] unable to find fastboot_key key_max value
[       2.325] test for multi os boot with display
[       2.385] show pic finish
[       2.385] load kernel start
[       2.402] load kernel successed
[       2.402] start address = 0x4a000000
[

U-Boot 2011.09-rc1-00049-g0330e33-dirty (Mar 23 2013 - 16:45:53) Allwinner Technology

CPU:   SUNXI Family
Board: A13-EVB
DRAM:  512 MiB
NAND:  3800 MiB
MMC:   no misc partition is found
SUNXI SD/MMC: 0
In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
-total partitions:4-
-name-        -start-       -size-     
bootloader  : 1000000       4000000     
env         : 5000000       1000000     
rootfs      : 6000000       87c28000   
UDISK       : 8dc28000      5fbd8000   
-----------------------------------


Things start to look different after
[       0.338] parser bmp file c:\os_show\bat0.bmp failed
[       1.839] no battery exist
[       1.839] key value = 1
[       1.839] recovery key high 6, low 4
[       1.843] unable to find fastboot_key key_max value
[       1.862] unable to open script file c:\linux\linux.ini
[       1.862] NO OS to Boot


I don't know what bat0.bmp and linux.ini are. I will try to find out.

There are also some other (minor ?) differences:
Line 1: I have 0x7ffffade,0xf56f67fe and you have 0xffffffff,0xffffffff
Line 5: boot0 versions are different
Line 8: boot1 sizes are different

I haven't updated my sunxi-bsp for a while. I think I will try it on a separate directory and see if it still works, but I need more time...