cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wfrederi
Participant
Participant
463 Views
Registered: ‎04-14-2020

Running PetaLinux 2019.2 Off-Network

Jump to solution

I am trying to get the PetaLinux Tools to function on a Linux PC running CentOS 7.6 with no network connection (it is connected to a LAN, but not on the Internet).  To do so, I have been following the instructions under the PetaLinux Tools sstate-cache artifacts - 2019.2 at the website for the PetaLinux Tools: https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools/2019-2.html.  I also deselected "Enable Network sstate feeds" and selected "Enable BB NO NETWORK" since these changes appear to be applicable to a non-networked setup.  The issue I am having is adding packages that don't appear to be in the standard set such as gpsd.

When I do a search for gpsd in the menu provided by "petalinux-config -c rootfs", there is no match found.  So, I followed other instructions to verify that it exists:

[labuser@localhost zc702_linux_test_project]$ petalinux-build -c "-e gpsd" | grep "^FILE="
FILE="/home/labuser/PetaLinux/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.17.bb"
ERROR: Failed to build -e gpsd

I then added it to project-spec/meta-user/conf/user-rootsconfig by inserting the line "CONFIG_gpsd" and added it as a user package to the rootfs PetaLinux configuration.  When I try to build, I get the following errors:

ERROR: gpsd-3.17-r0 do_fetch: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command /usr/bin/env wget -t 2 -T 30 --passive-ftp --no-check-certificate -P /home/labuser/PetaLinux/zc702_linux_test_project/build/downloads 'http://download.savannah.gnu.org/releases/gpsd/gpsd-3.17.tar.gz' (for url http://download.savannah.gnu.org/releases/gpsd/gpsd-3.17.tar.gz)
ERROR: gpsd-3.17-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /home/labuser/PetaLinux/zc702_linux_test_project/build/tmp/work/cortexa9t2hf-neon-xilinx-linux-gnueabi/gpsd/3.17-r0/temp/log.do_fetch.23278
ERROR: Task (/home/labuser/PetaLinux/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_1.8.bb:do_fetch) failed with exit code '1'
ERROR: Task (/home/labuser/PetaLinux/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.17.bb:do_fetch) failed with exit code '1'

I have attached the above mentioned log related to the gpsd error (I had to add the .txt extension for the attachment to be accepted).

How do I get external packages like gpsd added to the PetaLinux Tools installation?  In other words, from where and how do I download them,  where do I add them in the PetaLinux Tools environment, and how do I update the configuration to find them?  Does it have something to do with the "User Layers" under the "Enable BB  NO NETWORK" selection?

Is it as simple as downloading the file from http://download.savannah.gnu.org/releases/gpsd/gpsd-3.17.tar.gz to the downloads folder where I extracted the downloads tar contents?  I'm going to try that next.  If it works, I may have answered my own question.

0 Kudos
1 Solution

Accepted Solutions
wfrederi
Participant
Participant
420 Views
Registered: ‎04-14-2020

After looking into it a bit further, I found that these external packages don't necessarily come from SAVANNAH_GNU_MIRROR or SAVANNAH_NONGNU_MIRROR, but could come from multiple other sources (e.g. sourceforge).  So, the full process that I came up with as follows:

If you do a search using the '/' key in "petalinux-config -c rootfs" and find no matches.  Perform the following command to find the correct package to add (replacing gpsd with what you are looking for):

$ petalinux-build -c "-e gpsd" | grep "^FILE="
FILE="/home/labuser/PetaLinux/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.17.bb"

Open the file in the path that it identifies.  Edit the SRC_URI to point to the local downloads path (in my case, I added a locallibs folder under the PetaLinux install path and extracted the downloads and sstate files into that folder).  I like to save off the original line (since there is likely a '\' at the end of the line you will either need to remove the slash or include an extra comment line):

#SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
#
SRC_URI = "file:///home/labuser/PetaLinux/locallibs/downloads/${BP}.tar.gz \

Update the project-spec/meta-user/conf/user-rootfsconfig file to include the package by adding the following line (change gpsd to your desired package).

CONFIG_gpsd

Run petalinux-config -c rootfs, go to user packages and select your newly added package.  Exit the config tool and save.  Attempt to build.  If successful, you are done.  Otherwise, the build error outputs will show the network location to the file.  Retrieve the file from the specified network location.

EDIT: The following was removed since the path can be determined from the error output without parsing environment variables. In the case of gpsd, it uses environment variables; so, you will have to determine the path by opening bitbake.conf for your architecture to find the macro definition (under /home/labuser/PetaLinux/components/yocto/source/<arch>/layers/core/meta/conf).  The appropriate architecture can be found in the README file included in the PetaLinux Tools website.  

For gpsd, the network location was http://download.savannah.gnu.org/releases/gpsd/.  Download the file with the version that matches the results of the above find on a PC with a network connection (for gpsd, this was version 3.17).  Transfer the file from that PC into the downloads folder on the PetaLinux Tools PC: /home/labuser/PetaLinux/locallibs/downloads.

At this point, petalinux-build should complete successfully with the installed package.

You folder paths will likely be different since you will likely have installed the PetaLinux Tools and extracted the downloads and sstate archives in different locations.  There may be other quirks for certain packages that I am not aware of, but this is what worked for me.

View solution in original post

0 Kudos
3 Replies
wfrederi
Participant
Participant
447 Views
Registered: ‎04-14-2020

It was a little bit more than just copying the file.  I tried downloading the file from http://download.savannah.gnu.org/releases/gpsd/gpsd-3.17.tar.gz and placing it the downloads folder, but still had issues.  Then I changed the bb file (components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.17.bb) to point to the file path in the SRC-URI.  I had to include 3 slashes in the file path.

Original text from bb file:

SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
    file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \
    file://0004-SConstruct-disable-html-and-man-docs-building-becaus.patch \
    file://0001-include-sys-ttydefaults.h.patch \
"

Modified text:

SRC_URI = "file:///home/labuser/PetaLinux/locallibs/downloads/${BPN}/${BP}.tar.gz \
    file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \
    file://0004-SConstruct-disable-html-and-man-docs-building-becaus.patch \
    file://0001-include-sys-ttydefaults.h.patch \
"

A better way would probably just be to change the SAVANNAH_GNU_MIRROR environment variable to the folder name.  This should remove the need to edit the bb files.

Let me know if anyone has a better solution.

 

0 Kudos
wfrederi
Participant
Participant
421 Views
Registered: ‎04-14-2020

After looking into it a bit further, I found that these external packages don't necessarily come from SAVANNAH_GNU_MIRROR or SAVANNAH_NONGNU_MIRROR, but could come from multiple other sources (e.g. sourceforge).  So, the full process that I came up with as follows:

If you do a search using the '/' key in "petalinux-config -c rootfs" and find no matches.  Perform the following command to find the correct package to add (replacing gpsd with what you are looking for):

$ petalinux-build -c "-e gpsd" | grep "^FILE="
FILE="/home/labuser/PetaLinux/components/yocto/source/arm/layers/meta-openembedded/meta-oe/recipes-navigation/gpsd/gpsd_3.17.bb"

Open the file in the path that it identifies.  Edit the SRC_URI to point to the local downloads path (in my case, I added a locallibs folder under the PetaLinux install path and extracted the downloads and sstate files into that folder).  I like to save off the original line (since there is likely a '\' at the end of the line you will either need to remove the slash or include an extra comment line):

#SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
#
SRC_URI = "file:///home/labuser/PetaLinux/locallibs/downloads/${BP}.tar.gz \

Update the project-spec/meta-user/conf/user-rootfsconfig file to include the package by adding the following line (change gpsd to your desired package).

CONFIG_gpsd

Run petalinux-config -c rootfs, go to user packages and select your newly added package.  Exit the config tool and save.  Attempt to build.  If successful, you are done.  Otherwise, the build error outputs will show the network location to the file.  Retrieve the file from the specified network location.

EDIT: The following was removed since the path can be determined from the error output without parsing environment variables. In the case of gpsd, it uses environment variables; so, you will have to determine the path by opening bitbake.conf for your architecture to find the macro definition (under /home/labuser/PetaLinux/components/yocto/source/<arch>/layers/core/meta/conf).  The appropriate architecture can be found in the README file included in the PetaLinux Tools website.  

For gpsd, the network location was http://download.savannah.gnu.org/releases/gpsd/.  Download the file with the version that matches the results of the above find on a PC with a network connection (for gpsd, this was version 3.17).  Transfer the file from that PC into the downloads folder on the PetaLinux Tools PC: /home/labuser/PetaLinux/locallibs/downloads.

At this point, petalinux-build should complete successfully with the installed package.

You folder paths will likely be different since you will likely have installed the PetaLinux Tools and extracted the downloads and sstate archives in different locations.  There may be other quirks for certain packages that I am not aware of, but this is what worked for me.

View solution in original post

0 Kudos
wfrederi
Participant
Participant
397 Views
Registered: ‎04-14-2020

It should be noted that there are some cases where data might not need to be copied from an Internet location.  In Section 8 of the PetaLinux Tools 2019.2 reference guide (UG1144), there is a paragraph called Adding an Existing Recipe into RootFS that talks about adding packages (recipes) like iperf3.  In these cases, the package may not be in the RootFS configuration menu by default, but it may already be available in the downloaded packages or packages included in the PetaLinux Tools installation.

So, really the first thing to do is to add the CONFIG_<package> to the user_rootfsconfig file, enable it in the user packages in the RootFS configuration menu, and attempt to build.  If the build outputs errors related to the package, then the rest of the procedure would need to be followed.  Also, any error output would provide the network path where it is trying to find the package such that you wouldn't need to manually parse through macro definitions.

The solution has been updated with this info.

0 Kudos