jlamperez / meta-zynqberry

This repository contains yocto zynqberry layer
MIT License
2 stars 2 forks source link

using your recipe #1

Closed sebo83910 closed 7 years ago

sebo83910 commented 7 years ago

Hello Jorge,

I'm also using the zynqberry board. I wanted to give a shot to yocto and found you meta-zynqberry github. I do encounter a problem while building the images and after some time of search, I've decided to contact you.. The build fails at the do_xilinx_bootbin stage. Indeed, the BOOT.bin (from bootgen tools) is failing because the poky/build/tmp/deploy/images/zynqberry/u-boot-zynqberry.elf is not generated. And... I can't figure what I am doing wrong.

Have you ever encountered this issue before?

Here are the configuration I use:

### 
Build Configuration:
BB_VERSION        = "1.30.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "zynqberry"
DISTRO            = "poky"
DISTRO_VERSION    = "2.1.2"
TUNE_FEATURES     = "arm armv7a vfp thumb neon       callconvention-hard       cortexa9"
TARGET_FPU        = "hard"
meta              
meta-poky         
meta-yocto-bsp    
meta-xilinx       = "krogoth:e59717e80f6288410fa057e34233382bd327697a"
meta-xilinx-tools = "rel-v2016.4:fa8e38b8df947cc2d15a3005850e16d66388182b"
meta-oe           
meta-python       = "krogoth:e59717e80f6288410fa057e34233382bd327697a"
meta-zynqberry    = "krogoth:f166fdeb83417e1b81be815cc4554f8f80f4b260"

Thank you very much. And.. Thanks for your work so far.

Sébastien.

sebo83910 commented 7 years ago

Ok. strange enough. found out right after my message.... bitbake linux-xlnx u-boot-xlnx

:-)

jlamperez commented 7 years ago

Hi @sebo83910

I am glad you have found out what was going wrong :)

Jorge

sebo83910 commented 7 years ago

Hello,

It's me again. Sorry to bother. I'm really having a hard time to gather reliable information on building images for Zynq using Yocto. I'm looking to the procedure to use on the zynqberry, the file created on the /tmp/deploy/images/zynqberry. Do you have something? I mean a step to create and load a SD card?

thanks.

jlamperez commented 7 years ago

Hi Sebastian,

Have you flash your board with a Boot.bin? I usually create this with xilinx xsdk using the u-boot.elf created from yocto, bitstream and fsbl.

Once you have flashed the board you need to copy from /tmp/deploy/images/zynqberry to the sd-card:

and create a file named uEnv.txt with this content:

kernel_image=uImage
devicetree_image=zynqberry.dtb
bootargs=console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootwait earlyprintk
uenvcmd=echo Copying Linux from SD to RAM... && fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000

With this file you are saying to u-boot to find a kernel_image named uImage and devicetree_image named zynqberry.dtb

If you are still having problems with some steps tell me and I will try to create a wiki page explaining better.

Jorge

jlamperez commented 7 years ago

I have forgotten you also need to create a ext4 partition and extract the ...rootfs.tar.gz there

sebo83910 commented 7 years ago

Thanks for these infos. I've been using this link to program: https://github.com/Xilinx/meta-xilinx/blob/master/README.booting.md#xsdb

Here is the output I have from the console:

*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
U-BOOT for petalinux

reading u-boot.rgba                                                                                          
** Unable to read file u-boot.rgba **                                                                        
Unknown command 'dhcp' - try 'help'                                                                          
Hit any key to stop autoboot:  0                                                                             
Device: sdhci@e0101000
Manufacturer ID: 2
OEM: 544d
Name: SA16G 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.6 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading image.ub
** Unable to read file image.ub **
=> 

I've been following your advices but still unsuccessful. It seems there is something from previous tests with petalinux taking over.

jlamperez commented 7 years ago

It seems you have not flashed well boot.bin and you are using the default petalinux u-boot that is comming with the zynqberry board.

How are you creating boot.bin?

sebo83910 commented 7 years ago

The file BOOT.bin is created using the bitbake commande line. But in the procedure I've followed from the link I mentionned, I do not use the boot.bin file.

$ xsdb xsdb% connect xsdb% targets xsdb% fpga -f download.bit etc...

I guess the procedure I've used is for boot from JTAG. But it has no effect as well. Later on, I've followed the procedure in the same link for the SD card, I have two partitions:

$ ll /media/sebo/boot/
total 3983
drwxr-xr-x  2 sebo sebo     512 janv.  1  1970 ./
drwxr-x---+ 4 root root    4096 avril 18 22:08 ../
-rw-r--r--  1 sebo sebo  530584 avril 18 19:34 BOOT.bin
-rw-r--r--  1 sebo sebo     293 avril 18 20:53 uEnv.txt
-rw-r--r--  1 sebo sebo 3532528 avril 18 19:38 uImage
-rw-r--r--  1 sebo sebo    9037 avril 18 19:42 zynqberry.dtb

$ ll /media/sebo/root
total 84
drwxr-xr-x  18 root root  4096 avril 15 21:56 ./
drwxr-x---+  4 root root  4096 avril 18 22:08 ../
drwxr-xr-x   2 root root  4096 avril 15 21:56 bin/
drwxr-xr-x   2 root root  4096 avril 14 23:03 boot/
drwxr-xr-x   2 root root  4096 avril 14 23:03 dev/
drwxr-xr-x  17 root root  4096 avril 15 21:56 etc/
drwxr-xr-x   3 root root  4096 avril 15 21:56 home/
drwxr-xr-x   3 root root  4096 avril 15 21:56 lib/
drwx------   2 root root 16384 avril 18 19:19 lost+found/
drwxr-xr-x   2 root root  4096 avril 14 23:03 media/
drwxr-xr-x   2 root root  4096 avril 14 23:03 mnt/
drwxr-xr-x   2 root root  4096 avril 14 23:03 proc/
drwxr-xr-x   2 root root  4096 avril 14 23:03 run/
drwxr-xr-x   2 root root  4096 avril 15 21:56 sbin/
drwxr-xr-x   2 root root  4096 avril 14 23:03 sys/
drwxrwxrwt   2 root root  4096 avril 14 23:03 tmp/
drwxr-xr-x   9 root root  4096 avril 15 10:08 usr/
drwxr-xr-x   7 root root  4096 avril 15 09:16 var/

Still same results. I'm pretty sure I'm close but can't figure what's wrong.

jlamperez commented 7 years ago

Try programming BOOT.bin:

Tell me if your u-boot changes now

sebo83910 commented 7 years ago

I was able to program the flash through the Xilinx SDK. But... now I got nothing. It looks like the board is stuck. I got the red & green leds on and no trace on the console.

jlamperez commented 7 years ago

Good, it seems that the BOOT.bin you have created is wrong, probably due to the FSBL inside. Now you will need to create an FSBL proyect using a vivado design.

I recommend you to start using this vivado design or one reference design from trenz page and see the PS configurations.

If you choose the link above you have how to create the vivado proyect in the readme. The version of VIvado you have installed is important, supported 2016.2 or 2016.4, choose the correct branch in github

Once you have the vivado proyect opened you will need to generate bitstream and export your hardware to the xsdk.

In the xsdk you create a Board Support Package for this hardware and then you create an FSBL application. You will need to check xilffs in Board Support Package settings to be able to create the FSBL proyect.

Once you have the FSBL proyect created, click it and go to Xilinx Tools-> Create Boot Image.

In Create boot image you need to add the bitstream(if you want) and the u-boot.elf from yocto and click Create Image.

You will get a BOOT.bin and this is what you have to flash to the board.

sebo83910 commented 7 years ago

Do you go through all these steps? I'll check it out this evening but it seems weird to me. I've seen this procedure in tutorial but I thought using the recipes from Xilinx and meta-zynqberry would do job.

jlamperez commented 7 years ago

Yes, this is how I did it.

Most probably there will be other methods to boot the zynqberry, for example, creating a uImage.ub with yocto files or with the meta-xilinx-tools you have added but I have not tried them.

sebo83910 commented 7 years ago

Ok. I now have a boot. Here is what I've done:

The sdk (2016.4) did not propose to generate the fsbl. Or, I didn't find how... Meanwhile, I've tried the link here. I got a elf file this way. And, I like it because it all in command line.

I've tried to generate the boot.bin using the interface in the sdk tool but there are some options I don't know how to use. Do you have a screenshot? Or the bif file and the bootgen command?

I've created a bif file with these three items:

//arch = zynq; split = false; format = BIN
the_ROM_image:
{
    [bootloader]/home/sebo/projects/yocto-xilinx/fsbl/executable.elf
    /home/sebo/projects/yocto-xilinx/bitstream.bit
    /home/sebo/projects/yocto-xilinx/poky/build/tmp/deploy/images/zynqberry/u-boot.elf
}

The command line was this: $ bootgen -image zynqberry.bif -arch zynq -o /home/sebo/projects/yocto-xilinx/boot/BOOT.bin Note that if you use the tcl scripts from Trenz, there is a function TE:sw_run_hsi that generates the BOOT.bin.

Then, I programmed the flash. There must be a command line to do that as well.

Thanks for the time you've spent to help me. It means a lot. Are you still developing on this platform? As I try to do so, do you want to share some info later on?

Sebastien

jlamperez commented 7 years ago

Hi Sebastian,

See if this wiki page I have created with links to create FSBL and Boot.bin and some screenshots helps you.

Every operation you do in the xsdk has his terminal command associated and you can see it in the terminal tab. I usually do things with the gui interface because is more intuitive for me, but if you interested in the terminal commands check this terminal tab.

Now I am not using zynqberry so much, I bought it to build a drone with the pxfmini cape from erle-robotics and when I achived to take off I stop using it. If you are interested in vision a month ago I probe to connect the raspberry pi camera to the board, succesfully with rev1.3 but unsuccesfully with rev2, with a trenz webpage design in order to add it to the drone but nothing more.

It will be great if you share some info of your developments, I will be happy to see them and talk about them.

sebo83910 commented 7 years ago

Thanks for Wiki pages Jorge! I'm trying to debug this thing. There is no reason we can't get a good fsbl from bitbake. I've found the bif file generated and it seems ok (although the bitfile is not included) but the fsbl sources seem bad when I compare to the ones used to get things working yesterday. So I've subscribed to the meta-xilinx mailing list and asked few questions. I'll see what comes out of this. I keep you posted.

My main goal for now is to build some king of rover that I can control over the web. I want to proceed step by step. But basically consolidate the compilation tool chain first would be a start. Meawhile, I need to configure the kernel and other things to improve my distro.

/S

jlamperez commented 7 years ago

Interesting proyect the web controller car.

Which kind of car? RC adding zynqberry or simple one with two dc motors controlled by fpga? I suppose you are going to add a web server to your distro no? You will need to configure ethernet access or usb dongle in the wifi, tell me if you need some help. I configured them for my custom distro.

sebo83910 commented 7 years ago

Well, I haven't yet been that far on the rover hardware. I'm looking for info on this. My focus right now will be to customize the distro and yes, add the usb&wifi support. I do have a RTL8188CUS dongle.

sebo83910 commented 7 years ago

Hello Jorge,

Few questions I have. 1/ Do you have the ethernet controller working? Here is what I have. Configuring network interfaces... eth0: ERROR while getting interface flags: No such device After some search, I'm getting nowhere so far.

2/ I used the version krogoth of Yocto. I've seen a branch of your recipe for morty. Have you tried it? I seemed to me Xilinx for 2016.4 tools recommended using krogoth... Is your branch morty = Master branch?

3/ I've seen how to add tools/packages for rootfs. For adding wifi, I have to add device driver at kernel level right? How would you proceed?

thanks.

jlamperez commented 7 years ago

Hi Sebastien,

1/ Ethernet is controlled by the SMSC LAN95XX you need to add this to the kernel, it is located in

 Device Drivers  --->
    [*] Network device support  --->
        USB Network Adapters  --->
            [...]
            <M> Multi-purpose USB Networking Framework
            [...]
            <M> CDC Ethernet support
            [...]
            <M> SMSC LAN95XX based USB 2.0 10/100 ethernet devices

2/ Yes, morty branch and master are equal. Morty worked 4 months ago and now it should work but I have not tried.

3/ Maybe yes or maybe not. You need to check if your usb dongle is supported in the kernel or not. I have a Edimax EW-781UTC which is dual band(2.4 and 5 GHz), this wasn't supported in the kernel and I added. Here you can see how I did it using a yocto recipe.

sebo83910 commented 7 years ago

Thanks Jorge. It really helped. For the first point, I already tried through menuconfig to update the kernel configuration but bitbake did not find anything to recompile. I haven't figured why... So I use you kernel recipe. And it worked.

Fro the second point, do you remember the branches you used? Some recipe do not have a branch named morty...

for point 3, my wifi module is now loaded. I still have to figure how to configure the connection.

Do you have any idea why lsmod does not give any output?

Thanks again for your help.

jlamperez commented 7 years ago

I used to install the modules directly into the kernel with * instead M for the SMSC LAN95XX maybe I have confused you.

The branches I used were krogoth. Which recipes are they in morty branch?

Maybe you are not loading any module with yocto installing all in the kernel and this is why lsmod is empty.

sebo83910 commented 7 years ago

The meta-xilnx recipe has a morty branch for instance. Working on the wifi support. I guess your recipe meta-zynqberry-pfxmini configures it as an AP right? I want the board to connect to my home wifi. I've tried several methods (dhcp, static,..). No luck yet.

It seems the driver is correctly loaded:

wlan0     Link encap:Ethernet  HWaddr 00:13:ef:60:1f:a1  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

But when I try to bring it up, here is what I have.

root@zynqberry:~# ifup wlan0                                                                                                                                                               
rtl8192cu: MAC auto ON okay!
rtl8192cu: Tx queue select: 0x05
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
udhcpc (v1.24.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background

Thanks.

jlamperez commented 7 years ago

You can use meta-zynqberry morty branch but this branch is synchronized with yocto morty and meta-xilinx morty branch. The same happens with krogoth.

Yes, in my image I configured the wifi like an AP. You can check if adding this recipes to your image solve your problem

                  iw \
                  wireless-tools \
                  wpa-supplicant \
                  wpa-supplicant-passphrase \
                  wpa-supplicant-cli \

Or also you can check this guide to see if you can connect to your local network like a client.

sebo83910 commented 7 years ago

Is there an interest to switch to morty?

for the wifi.. I'm stuck. I've followed the link. Instead of "manual", I used "dhcp". Now the boot hangs:

INIT: Entering runlevel: 5
Configuring network interfaces... rtl8192cu: MAC auto ON okay!
rtl8192cu: Tx queue select: 0x05
rtl_usb: reg 0x824, usbctrl_vendorreq TimeOut! status:0xffffff92 value=0x6
rtl_usb: reg 0x870, usbctrl_vendorreq TimeOut! status:0xffffff92 value=0x6
rtl_usb: reg 0x860, usbctrl_vendorreq TimeOut! status:0xffffff92 value=0x6
rtl_usb: reg 0x860, usbctrl_vendorreq TimeOut! status:0xffffff92 value=0x6
random: nonblocking pool is initialized

How can I check the driver; I mean the version for instance if it is loaded in the kernel... I wonder if it needs a patch.

jlamperez commented 7 years ago

It's up to you, morty is newer and I supported because when I was developing krogoth layer it was just released and I wanted to have the meta-layer updated. About the driver you are going out of my scope, it is difficult for me without your usb dongle to help you more with the wifi, I am sorry.

sebo83910 commented 7 years ago

For Morty, I need to look at the change log and see if that is worth it to switch.

Regarding the wifi, what is the dongle you are using? I'm trying to understand how you've set it up as a AP. I don't see where you define the SSID and the password.

sebo83910 commented 7 years ago

Found it in the hostapd.conf