pavel-demin / red-pitaya-notes

Notes on the Red Pitaya Open Source Instrument
http://pavel-demin.github.io/red-pitaya-notes/
MIT License
337 stars 209 forks source link

Development Machine #639

Closed davidhay45 closed 6 years ago

davidhay45 commented 6 years ago

Hi

I am trying to set up a development machine on my Windows 10 PC following the instructions given.

I think I am almost there (!), Under the VM I can login via root and I have downloaded the Xilinx_Vivado_SDK_2016.4_1215_1.tar.gz and unpacked it but I can't run the installer because of the lack of X11. So I have run SSH with X11 enabled but I can't login to the VM via SSH with root/changeme (password wrong) and when I log in via red-pitaya/changeme I don't have permission to create the xsetup via sed.

So, is the root password via SSH something else? Or what should I do? I have many years experience of Windows and Visual C++ but I am a beginner at Linux as you will have guessed.

I very much appreciate all the work you have done here it is amazing.

Thanks

David

ghost commented 6 years ago

Just a guess:

Root login via ssh could be forbidden. So ssh login with RedPitaya and then change to su or use sudo.

Gruss Hajo

pavel-demin commented 6 years ago

Hajo is right.

The root login via SSH is disabled by default. So, the easiest way to the root login is to login via SSH as red-pitaya and then run su -.

davidhay45 commented 6 years ago

Spot on.

Thanks

davidhay45 commented 6 years ago

image

This is like peeling an onion only as I get closer to the core the layers get thinner and there are more of them.

Can anyone give me a clue to the "unsupported auth protocol" please?

pavel-demin commented 6 years ago

If you login via SSH as red-pitaya and switch to root, then you can't run X11 applications from the root account.

There are several possible solutions:

To run the installation script from the red-pitaya account, you'll need to change the permissions for the /opt/Xilinx directory.

su -
mkdir /opt/Xilinx
chown red-pitaya:red-pitaya /opt/Xilinx
exit
davidhay45 commented 6 years ago

Next layer reached, thanks. I now get can't connect to internet to check SDK version and I can't ignore it because I don't have mouse control so more config to do.

Thanks again.

David

davidhay45 commented 6 years ago

Got past the mouse click issue!

davidhay45 commented 6 years ago

Well the install completed. What sort of licence do I need? For some reason the VM does not have internet connectivity so that is what I will look at next.

pavel-demin commented 6 years ago

What sort of licence do I need?

WebPACK. It's enabled by default but it probably requires an Internet connection.

davidhay45 commented 6 years ago

Thanks. I have fixed the internet connectivity. How do I restart the licence manager?

Is there debian forum for Linux help?

pavel-demin commented 6 years ago

How do I restart the licence manager?

I don't know. I think that it should work without restarting the licence manager. I'd suggest to build the LED blinker project (make NAME=led_blinker bit). If it works and outputs led_blinker.bit, then the licence is OK.

Is there debian forum for Linux help?

http://forums.debian.net

However, I'd suggest to start with some reading. Here are some links that look interesting:

http://www.ee.surrey.ac.uk/Teaching/Unix https://ryanstutorials.net/linuxtutorial https://debian-handbook.info https://www.debian.org/doc

davidhay45 commented 6 years ago

Your support is great, thanks.

Final question for a while (I hope). What directory structure is expected? IE where do the app files go and what directory do I run make from?

Thanks

pavel-demin commented 6 years ago

What directory structure is expected? IE where do the app files go and what directory do I run make from?

Please have a look at the LED blinker notes.

I'd say that the Source code and Getting started sections have the answers to your questions.

You can find more details about the directory structure and about my toolchain for ZYNQ in my Club Vivado presentation (slides 90-111): http://www.origin.xilinx.com/publications/products/vivado/club_vivado/2016/einhoven-2016-presentations.zip

davidhay45 commented 6 years ago

I have done

make NAME=led_blinker all

and it appeared to ok. Presumably if it had errors it would say so?

When I try and build a bootable SD card I get:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Have I gone wrong somewhere?

pavel-demin commented 6 years ago

When I try and build a bootable SD card I get: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set Have I gone wrong somewhere?

The error message looks pretty scary. Could you check what the following command returns?

ls -l /usr/bin/sudo

On my system it returns

-rwsr-xr-x 1 root root 157760 May 29  2017 /usr/bin/sudo
davidhay45 commented 6 years ago

-rwxr-xr-x 1 red-pitaya red-pitaya 157760 May 29 2017 /usr/bin/sudo

I think I must have done it for the /usr/bin/* to try and overcome an older problem. I suspect I should chown /usr/bin back to root?

I am away until Tuesday but a question, I read your presentation for the Eindhoven conference and would like to comment but not via the forum, is that ok with you?

pavel-demin commented 6 years ago

I suspect I should chown /usr/bin back to root?

Yes. And you should also set the setuid bit:

chmod u+s /usr/bin/sudo

I read your presentation for the Eindhoven conference and would like to comment but not via the forum, is that ok with you?

Yes, no problem. You can find my e-mail address in my profile.

davidhay45 commented 6 years ago

I am confused by the two types of SD card image, Debian and Alpine. It would appear that you are only now using the Alpine version, is that correct?

Rolf-L commented 6 years ago

Both versions are working fine. Many thanks Pavel for your excellent work. Rolf -DJ7TH- www.dj7th.de

davidhay45 commented 6 years ago

Whilst that may be true, are both versions current and why would you use one rather than the other?

pavel-demin commented 6 years ago

I am confused by the two types of SD card image, Debian and Alpine. It would appear that you are only now using the Alpine version, is that correct?

Correct. At the moment, I'm mostly using the SD card image based on Alpine Linux.

Whilst that may be true, are both versions current and why would you use one rather than the other?

The pre-built SD card image based on Debian Linux is usable. However, I can think of the following problems with this image:

For me, the SD card image based on Alpine Linux has the following advantages over the SD card image based on Debian Linux:

pavel-demin commented 6 years ago

I've just updated the pre-built SD card image based on Debian and the debian and ubuntu scripts with this commit. They are now compatible with the current version of the scripts and patches that I use to build Linux.

davidhay45 commented 6 years ago

I have executed the following:

cd /opt/Xi cd X

source /opt/Xilinx/Vivado/2016.4/settings64.sh

git clone https://github.com/pavel-demin/red-pitaya-notes

cd red-pitaya-notes

make NAME=sdr_transceiver_hpsdr bit

It ran for some minutes and then stopped with the message in the screenshot whereit has stayed for the last five hours and is still apparently running. Is this correct? The log files do not appear to exist.

image

pavel-demin commented 6 years ago

The messages on the screenshot look OK. The impl_1 step takes long time to complete. However, not more than half an hour for the sdr_transceiver_hpsdr project.

I think that building sdr_transceiver_hpsdr requires more memory than is available on your virtual machine. It starts to swap and everything slows down.

I'd suggest to increase the memory size to 3 or 4 GB.

davidhay45 commented 6 years ago

I increased the memory to 4gb and then re-ran as below. As expected it skipped the bits it had done but then it gave the error as below. I had rebooted the PC before starting the job again. So what is:

ERROR: [Common 17-69] Command failed: Run'impl_1' is already running and cannot be relaunched.

Any ideas?

red-pitaya@debian:/opt/Xilinx/Xilinx_Vivado_SDK_2016.4_1215_1/red-pitaya-notes$ make NAME=sdr_transceiver_hpsdr bit
mkdir -p tmp
vivado -nolog -nojournal -mode batch -source scripts/bitstream.tcl -tclargs sdr_transceiver_hpsdr

****** Vivado v2016.4 (64-bit)
  **** SW Build 1733598 on Wed Dec 14 22:35:42 MST 2016
  **** IP Build 1731160 on Wed Dec 14 23:47:21 MST 2016
    ** Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.

source scripts/bitstream.tcl
# set project_name [lindex $argv 0]
# open_project tmp/$project_name.xpr
Scanning sources...
Finished scanning sources
INFO: [IP_Flow 19-234] Refreshing IP repositories
INFO: [IP_Flow 19-1700] Loaded user IP repository '/opt/Xilinx/Xilinx_Vivado_SDK_2016.4_1215_1/red-pitaya-notes/tmp/cores'.
INFO: [IP_Flow 19-2313] Loaded Vivado IP repository '/opt/Xilinx/Vivado/2016.4/data/ip'.
open_project: Time (s): cpu = 00:00:07 ; elapsed = 00:00:07 . Memory (MB): peak = 1084.113 ; gain = 89.605 ; free physical = 3068 ; free virtual = 4591
# if {[get_property PROGRESS [get_runs impl_1]] != "100%"} {
#   launch_runs impl_1 -to_step route_design
#   wait_on_run impl_1
# }
ERROR: [Common 17-69] Command failed:  Run'impl_1' is already running and cannot be relaunched.
INFO: [Common 17-206] Exiting Vivado at Wed Dec  6 12:14:35 2017...
Makefile:152: recipe for target 'tmp/sdr_transceiver_hpsdr.bit' failed
make: *** [tmp/sdr_transceiver_hpsdr.bit] Error 1
red-pitaya@debian:/opt/Xilinx/Xilinx_Vivado_SDK_2016.4_1215_1/red-pitaya-notes$
pavel-demin commented 6 years ago

Command failed: Run 'impl_1' is already running and cannot be relaunched.

This is a part that isn't handled well by my scripts. I just remove all the project's files before rerunning make:

rm -rf tmp/sdr_transceiver_hpsdr*
make NAME=sdr_transceiver_hpsdr bit
davidhay45 commented 6 years ago

I found this, it suggests that jobs running concurrently is the issue.

https://forums.xilinx.com/t5/Synthesis/Error-running-Synthesis-via-quot-Generate-Bitstream-quot/td-p/444580

pavel-demin commented 6 years ago

I'm not sure that the link is about the same problem.

I think that when you stopped the long running build process, Vivado didn't properly remove some files indicating that it was running.

When you restarted the build process, Vivado found the files indicating that it was still running and decided to output the "Run 'impl_1' is already running" error message.

So, I still think that the easiest solution is to remove all the project's files before rerunning make.

davidhay45 commented 6 years ago

However, doing as you suggest appears to have worked, so thank you. It took about 10 mins to complete the impl_1 step.

During the complete build there were quite a lot of warning messages, eg

WARNING: [BD 5-235] No pins matched 'get_bd_pins fir_1/S_AXIS_DATA' and WARNING: [BD 41-1306] The connection to interface pin /tx_0/mult_0/s_axis_b_tdata is being overridden by the user. This pin will not be connected as a part of interface connection S_AXIS_B

plus numerous others.

So my questions now are: do the warnings matter? how can I know the build worked?

I should explain that I am trying to get to the stage where I am running sdr_transceiver_hpsdr with a system that I built and I can then try various things.

Fascinating stuff, takes me back to my days as a software engineer with Philips Telecom! Thanks.

pavel-demin commented 6 years ago

do the warnings matter?

Normally, I only worry about critical warnings. From time to time, I also check the non-critical warnings, but most of the time, I don't know what to do about them.

how can I know the build worked?

If you have tmp/sdr_transceiver_hpsdr.bit, then it's already a good sign.

You can also open the project in Vivado (vivado tmp/sdr_transceiver_hpsdr.xpr) and check the 'Project Summary' and 'Design Runs' tabs. If nothing is red, then I consider it OK.

Suggested reading: UG900, UG906.

davidhay45 commented 6 years ago

I do indeed have the .bit file!

My final step is to make a zip of the SD card but your script source (helpers/build-all.sh) references the SD card via mmcblk0p1 which I don't think I have access to from a VM.

What would you advise me to do? I don't really need any more than sdr_transceiver_hpsdr and so far I have not "made" the other apps.

pavel-demin commented 6 years ago

your script source (helpers/build-all.sh) references the SD card via mmcblk0p1 which I don't think I have access to from a VM.

The script works without the SD card. It creates all the required directories including mmcblk0p1.

pavel-demin commented 6 years ago

alpine.sh requires an additional package:

apt-get install squashfs-tools
davidhay45 commented 6 years ago

I am trying to get alpine.sh to work in my environment. I see that the script uses chroot and appears to pipe a set of commands into dash. I don't understand what this is doing, is there something I can read?

Is it feasible just to recompile sdr_transceiver_hpsdr and replace it on the SD card?

pavel-demin commented 6 years ago

I am trying to get alpine.sh to work in my environment.

Normally, it should work out of the box. What error messages do you see?

Is it feasible just to recompile sdr_transceiver_hpsdr and replace it on the SD card?

Yes. In case of a pre-built SD card image based on Alpine Linux, just copy sdr_transceiver_hpsdr.bit to apps/sdr_transceiver_hpsdr and rerun the start.sh script or restart the application via the web interface.

pavel-demin commented 6 years ago

I don't understand what this is doing, is there something I can read?

It's a combination of chroot and so called here document: https://en.wikipedia.org/wiki/Chroot http://tldp.org/LDP/abs/html/here-docs.html

In the alpine.sh script, the commands between chroot $root_dir /bin/sh <<- EOF_CHROOT and EOF_CHROOT are executed in the environment of the Alpine Linux root directory.

davidhay45 commented 6 years ago

I don't think the SD card peripheral is available to the VM under Windows 10 so I modified the alpine.sh script to change mmcblk0p1 to sdcard. After the script had run I searched for sdcard and found it at:

/opt/Xilinx/Xilinx_Vivado_SDK_2016.4_1215_1/red-pitaya-notes/alpine-initramfs?/alpine-root?/media/sdcard

where the ? appears to be a \r. I can't get at the contents of sdcard, perhaps because it gets used under the chroot jail. Any ideas?

pavel-demin commented 6 years ago

I don't think the SD card peripheral is available to the VM under Windows 10 so I modified the alpine.sh script to change mmcblk0p1 to sdcard.

The alpine.sh script doesn't require any SD card. It creates a .zip file that should be unpacked to a FAT formatted micro SD card.

If you rename mmcblk0p1 to sdcard, the resulting .zip file won't work properly.

Any ideas?

At the moment, I don't understand what problem you're trying to solve. Do you see any error messages when running the unmodified alpine.sh script?

davidhay45 commented 6 years ago

I see errors as it tries to compile transceiver_emb, snb.c and the zip command fails as the zip utility is not installed. The problem is that I want to create a sd card and I can't.

pavel-demin commented 6 years ago

I see errors as it tries to compile transceiver_emb, snb.c

I've just rerun the alpine.sh script and I see many warnings when it builds the wdsp library but no errors.

the zip command fails as the zip utility is not installed

Installation of the zip utility was indeed missing from my notes. I've just added it with this commit.

You can install it with the following command:

apt-get install zip
davidhay45 commented 6 years ago

That appeared to work but still gave warnings re transceiver_emb, why?

pavel-demin commented 6 years ago

That appeared to work but still gave warnings re transceiver_emb, why?

Most of the warnings are from the compilation of the WDSP library. If you think that some or all of them should be fixed, then I'd suggest to contact the developers of the WDSP library.

davidhay45 commented 6 years ago

I am now running my RP on an SD card that I have generated so this stage is complete. Many thanks.

pavel-demin commented 6 years ago

Great! Thanks for going through the instructions and for highlighting all the problems!

davidhay45 commented 6 years ago

I thought I would summarize the problems I came across:

Initial Vivado loading has to be with a graphical interface loaded, I had difficulty in getting X11 to work. Under a SSH client (I used PuTTY) the root login is disabled. I was confused by the request to obtain a licence for Vivado, the answer was to ignore the request. There were apps I needed that had to be loaded manually, squashfs-tools and zip. The make process virtually stopped because I had only allocated the Virtual Machine 2048mb of memory, On this was increased to 4096mb it went OK. I was expecting the make all job to be a lot quicker but it got there in the end.

Thanks again to Pavel for all his help.

davidhay45 commented 6 years ago

Hi

I decided to look at the actual apline.sh script I had used and tried to open the VM. It gave the following:

image

The only thing I can think of is that this is a problem with Oracle VM Virtualbox and has shown up because I have upgraded my Windows 10 to the 1709 version. Have you seen this before?

pavel-demin commented 6 years ago

It works fine with Windows 7. I don't have Windows 10. I see that a similar problem is discussed on the VirtualBox forum: https://forums.virtualbox.org/viewtopic.php?f=6&t=82249 https://forums.virtualbox.org/viewtopic.php?f=6&t=85395

pavel-demin commented 6 years ago

One of the posts on the VirtualBox forum suggest reinstalling VirtualBox to solve this problem: https://forums.virtualbox.org/viewtopic.php?f=6&t=83696#p405149

davidhay45 commented 6 years ago

Reinstalling VirtualBox removed the “invalid data” but now I can’t PuTTY to the VM, it gives “host not found”. I have posted this to the virtualbox forum.

davidhay45 commented 6 years ago

The VirtualBox forum provided a solution to this.

https://forums.virtualbox.org/viewtopic.php?f=6&t=85910&p=409261#p409261