This is a cache of https://discuss.96boards.org/t/beginer-questions-setting-up-the-linux-development-environment-for-the-dragonboard/6408. It is a snapshot of the page at 2024-10-31T09:56:28.150+0000.
Beginer questions: Setting up the Linux development environment for the DragonBoard - DragonBoard410c - 96Boards Forum

Beginer questions: Setting up the Linux development environment for the DragonBoard

This is my first st on the subject, I’ll try to avoid silly questions. That means I’ll do my homework first. Got several good books “Mastering Embedded Linux Programming” by Chris Simmonds seems to be a good one and has a reference to 96Boards in there.
First a recap of what I have so far:

  • Grabbed a fresh DragonBoard 410C and installed latest Debian distribution.
    It took me a while to figure out which one of all these is the correct one (a readme file explaining what are those files would be great):
    image
    Downloaded the full install (non developer) version for SD installation and burned the image into SD card. The first attempt to load it didn’t work, I got some errors and command line but not GUI. I try to reload it but it seems that SD card image gets destroyed during the OS installation and needs to be reloaded before each install. So, I burned it again in the SD from the downloaded image and the second time I got the graphical environment. The target is ready needing only some libs but I found help on how to do that in this forum.

Development Host

I downloaded the latest distro of Fedora and loaded it into VMWare virtual machine. It worked as a charm out of the box. now I need to install the toolchain there.
First question:
Can someone tell me what I need from all this and how to install it in Fedora?
image

again a README file explaining what is the purpose of the contents in each of those directories would go a long way.

That’s all for now.
Thanks!

The information you need should be in the release notes
http://releases.linaro.org/96boards/dragonboard410c/linaro/debian/latest/

For the toolchain, the link is also in the release notes (search for “Linaro GCC cross compiler”)

Hope it helps

I went throw the release notes in both cases, but they delve into specific topics, like building a custom kernel. This is advanced material that assumes that the reader has a lot of background knowledge. What is missing here is a step by step, assume nothing, guide. I’ll keep looking.

Thanks!

Guillermo

The usual toolchain convention is arch-[vendor]-os-abi

  • arch is the CPU architecture, the dragonboard-410c has a 64-bit ARMv8 SoC, it’s aarch64
  • os is the operating system (none, linux,…), you’re db410c run debian, so you run a linux os
  • abi is the application binary interface which mainly defines a convention to generate code and data (data alignment, function call, syscall, etc…)

So in your case, you want the aarch64-linux-gnu toolchain.
Since you are going to build from a different architecture (your PC/VMWare) you need to cross-compile from your host (I assume intel PC) for the target (db410c). So you want to use the x86_64 prefixed toolchain:
e.g. gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

Once you have downloaded the toolchain, you can extract it.
Optionally, you can add toolchains binaries directory to your Linux PATH environment variable:
e.g.

export PATH=/home/myuser/Workspace/toolchains/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/:$PATH

You should now be able to run e.g. aarch64-linux-gnu-gcc to build C source.

Now, how to use it depends on the project build tool/facility (IDE, configure script, Makefile…).
For example, to cross compile a Linux kernel you mainly need to set the ARCH and CROSS_COMPILE env variables. Simple Makefiles usually uses the $(CC) variable to invoke the C compiler …

Interesting old wiki:
http://processors.wiki.ti.com/index.php/Linux_Training:Introduction_to_Cross_Compiling

I’m afraid I’d have to start by asking how did you arrive at this part of the fileserver? This server is not really intended to be navigated by hand so the absence of README is pretty much expected so depending on context the fault might be with the document that referred you here rather than on the fileserver.

If you arrived from https://linaro.org/downloads then the summary is on the site you navigated away from to read the release notes (as is the information that for gcc-8 and upwards you should obtain the toolset from Arm instead: https://developer.arm.com/open-source/gnu-toolchain/gnu-a ).

PS I do think we need to make the notice about getting the toolset from Arm a little more prominent though!

Daniel, Loic,
Thank you both for the extensive guidance. I’ll read through both in detail later.
I’m now finishing configuring two VMs (less tool chain). One is Fedora and the other is Ubuntu, afterI realized that Fedora is a different distribution. It may not be a major issue as a development machine but it is an interesting exercise to setup two parallel environments. “Linux is a religion with many gods, and it is complicated to please them all”.

I’ll report later what steps I took to setup the environments.

Regards,
Guillermo

Daniel,
For the firmware image I arrived drilling down through the linaro.org download page:
http://releases.linaro.org/96boards/dragonboard410c/linaro/debian/18.01/

same for the toolchain, and then up a couple of directories and down to the highest available because “Latest” shows just a list of files without notes:
https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/

Best regards,
Guillermo

I see.

Yes, the release notes record what compiler was used for the
release rather than as a suggestion about what should be used
for own development.

If you are starting out its probably best to adopt the latest compilers
from Arm (links from the binaries/ directory as gcc-8 ).

Hi guys, here are a few easy ones, I think:

  1. How do I change the default host name, and user name?

  2. How I make the host name visible to the router and Windows (SMB) networks?

  3. Where do I change the system wide PATH?
    (logged as su, edited PATH= in “/etc/profile” but that is not the right place). The environment I see in QTerminal with “set” is not that one.

Any book recommendation that follows more closely the conventions of this Debian distribution?
I have Linux Bible but this one is centered in Red Hat and Fedora.

Thanks,
Guillermo

Changing hostname:
https://wiki.debian.org/HowTo/ChangeHostname

For the username, you can add and user with ‘useradd’ (cf useradd -h)
Or in root (sudo su), you can use usermode to change user properties:

usermod -l newname oldname

AFAIK you also need to update the associated home directory:

usermod -d /home/newhome -m newname

(so probably better to simply add an user and remove the linaro one if necessary)

You mostly need mdns (ZeroConf - Debian Wiki).
This can be achieved via avahi daemon (avahi-daemon.conf(5): avahi-daemon config file - Linux man page).
AFAIR, you need to enable publishing in config (/etc/avahi-daemon.config).

disable-publishing = no

Samba: https://wiki.debian.org/SambaServerSimple

I think ‘/etc/environment’ is what you’re looking for.

Maybe look at Debian -- Debian Books

Debian is mostly a collection of packages/tools sitting on top of a regular Linux.
I would tend to say RTFM ;-), (Linux ‘man’ is really helpful when you know what you want to use).

Thanks a lot Loic,

Coming from 35+ years of programming in X86 assembly, C/C++ MSDOS, C++ Windows, and the last 5 C# .NET, most of the time I know what I should do, the problem is where to find the information I need or what is the command line that does what I need. Searching consumes now 90% of the time in my learning curve.

Best regards,
Guillermo

Hi Loic,

Changed hostname in all files that reference it according to the Wiki page.
Listed the files with grep “$(hostname)” /etc/ -r1

No luck finding the system wide PATH. In the Linaro distribution /etc/environment is empty. In Ubuntu that file has a single line with PATH={the path string}. Like above I tried finding it with sudo grep “PATH=” /etc/ -r1. and got a gazillion hits!. No obvious one at first glance. There has to be a simpler way to find it.

More questions:

  1. I can’t create a mount point to a NAS server I have in my network. It is a Western Digital appliance in which I exposed a public folder Labdata. Per the setup page of the share, the NFS share is nfs://192.168.1.102/nfs/Labdata. No guessing about the target. created the necessary share point dirs.
    $ sudo mkdir /mnt/data
    $ sudo mount nfs://192.168.1.102/nfs/Labdata. /mnt/data ← fails in all platforms (Ubuntu, Fedora, Linaro). In Linaro the error says: /mnt/data: bad option;
    $ sudo /sbin/mount.ntfs nfs://192.168.1.102/nfs/Labdata. /mnt/data ← also fails in all three
    HOWEVER: Both Ubuntu and Fedora can see and mount it with their respective graphical file browsers. So, what am I missing here?

  2. How do I share a folder in Linaro so it can be mounted by the other Linux machines?, I thought that is via NFS, but it seems that it is not the right way. Fedora has by default a Public folder visible from Ubuntu, but /etc/exports used by NFS is empty in that machine.
    For the Windows network I know I have to use Samba, but I’ll save that dance for later.

(I’m starting to get frustrated, every trivial task is a roadblock full of quicks. Two weeks and counting and still cant get my environment ready to start porting my application).

Best regards,
Guillermo

I think this might be your 35 years pushing you in a direction that would not normally encouraged.

Unix derived systems don’t really have a system wide PATH in the same way Windows does and it is very bad form for an application to require the system wide path to be updated. That is is bad form for anyone (except a system admin of a traditional multi-user Unix-like OS) is why you are having a hard time finding how to do it.

So rather than tell you how to do it I’d prefer to ask why you need to do so?

For the nfs stuff I’ve not come across URI style mounts before… I suspect it is a sugared syntax used by the GUI tools and not understood by the CLI. I would have expected the command to look like: sudo mount -t nfs 192.168.1.102:nfs/Labdata /mnt/data .

Regarding ad-hoc file sharing there are multiple ways to do it but if you are doing development and want to access the contents of the DB410C from a more powerful machine I would recomment sshfs. Something like this (run this on the PC… no config is required on the DB410C and this is one of the reasons to recommend it):

mkdir $HOME/db410c
# Replace /home/guillermo with whatever folder you most need to share
# (but if you need to mount directories other than your home perhaps
# stop and think... the "best" answer might be similar to the global
# PATH answer above).
sshfs linaro-alip:/home/guillermo $HOME/db410c
# Do stuff here and when you are done unmount with...
fusermount -u $HOME/db410c

Hi Daniel,
Yes, I admit that am irremediably biased at this point and most likely trying to do things the way I imagine how they should work instead of the way they are designed. Last night I was frankly frustrated.

Some background information is necessary here.
Regarding the PATH is because of the following; I just installed .NET Core in all three platforms (no problems there). I have 2 years worth of work in C# that I need to move to Linux (that is because there are other third party device interface libraries that only exist in that platform). I have to have this NET Core library, and the command line tool “dotnet” to run .NET applications from the console, always available to each new console, and eventually to the application(s) running in the background as a service (the final product). The .NET Core installation instructions for ARM64 read the following:

[quote]
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-2.1.403-linux-arm64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
The above commands will only make the .NET SDK commands available for the terminal session in which it was run.
You can edit your shell profile to permanently add the commands. There are a number of different shells available for Linux and each has a different profile. For example:
_ Bash Shell: ~/.bash_profile, ~/.bashrc_*
_ Korn Shell: ~/.kshrc or .profile_*
_ Z Shell: ~/.zshrc or .zprofile_*
Edit the appropriate source file for you shell and add :$HOME/dotnet to the end of the exiting PATH statement. If no PATH statement is included, add a new line with export PATH=$PATH:$HOME/dotnet .
Also add export DOTNET_ROOT=$HOME/dotnet to the end of the file.
[end of quote]
So, following the above advise, I was looking for the Bash shell settings to add this package to the PATH. That’s why I trying to do it. So, how do I achieve this?, what is the purpose of PATH otherwise?

NAS share mount
sudo mount -t nfs 192.168.1.102:nfs/Labdata /mnt/data seems to work but I get this error:
`mount 192.168.1.102:nfs/Labdata /mnt/data: can’t find in /etc/fstab.
Should I manually edit /etc/fstab and add it there?, what’s the syntax?

I can SSH into the DragonBoard from any platform, no problem. I’ll try SSHFS to establish the link I’m looking for. What I need is a simple way to develop and test in in the development machine(s) and then move the files over the DragonBoard and test them there. With that I can get up and running (I’m not dreaming about doing remote debugging at this point).

… more on mount:
sudo mount -t nfs 192.168.1.102:nfs/Labdata /mnt/data on the DragonBoard I get a slightly different error message:

mount: /mnt/data: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program.

tried again after a sudo chmod 0777 /mnt/data and didn’t make any difference. Got the same error.

… ****** running sshfs on Ubuntu (after installing it):

$ mkdir $HOME/db410c
$ sshfs db410cd01:/home/linaro $HOME/db410c
$ read: Connection reset by peer ← Error

Same result for sshfs from Fedora → Linaro, Linaro → Ubuntu, and
Windows PowerShell → Linaro
Connection reset by 192.168.1.124 port 22

Solved: Connection reset by peer Error
solution: sshfs linaro@192.168.1.124:confused: $HOME/db410c (SUCCESS!)

The problem: the device’s host name is not propagated through the network. Using the hard coded IP address solves the problem.This error message above is ranking high in my list of misleading error messages! (assuming peer mean the target host name).

This brings me back to one of my earlier questions, what service should I run to make the host name visible to other hosts and the router?

PS: Also noted that only ssh is implemented now in Windows’ PowerShell. For sshfs I have to use a third party utility. There are a few out there, but I suspect that it will soon be added to it.

It is very much the purpose of PATH but the question is whether you tailor it system-wide (files in /etc) or per-user (files in $HOME). Tweaking the PATH is very common but all customization is normally applied per-user. The summary then is just add whatever you need to $HOME/.bashrc:

export PATH=$PATH:<extra_bits>

This will not affect already started shells but will affect every new shell you start after making the change and be persistent across reboots.

My advice would be not to worry too much about korn or zsh (or csh or tcsh which are even more difficult to account for). Every major GNU/Linux distribution defaults to bash as the default user shell. The effect of this is that, whilst some people do choose a different shell (or select a niche distro), these users have typically made a deliberate decision to do so and generally have the expertise required to tailor instructions written for bash to their own shell.

To help such uses when I write docs I usually separate the semantic action required (extend PATH) from an example of how to achieve it in the most common case (edit .bashrc). For example:

  • Add $HOME/myapp to your PATH. If you shell is bash this can be achieved with the following command: echo export PATH=\$PATH:\$HOME/myapp >> $HOME/.bashrc and then starting a new terminal.

It’s not perfect (since some users don’t know whar their shell is) but if they do need help they will probably ask questions that are easy to answer.

This will depend somewhat on your router.

With my own router name resolution works out of the box with DB410C. AFAIR the DB410C will advertise its name to the router are part of the DHCP exchange to request an IP address. This makes the router responsible for caching the name and providing it to other devices. Thus on my home network the hostname propagates automatically through traditional DNS without any configuration required on the DB410C (at least to all machines that use my router as their primary DNS server).

If your network does not allow the DHCP server to propagate names to the DNS server then you might have to look at alternatives such as mDNS (as suggested by Loic earlier). However I’m not really best placed to test this since this approach since I am able to look up the names regardless of whether mDNS is working or not.

Nearly missed one :wink:

The helper program for NFS is in a package called: nfs-common . If you are curious I do “just know” that the necessary program is called mount.nfs but after that I can look it up from the command line:

# Download tool to search packages by content (and update the local database it needs)
sudo apt install apt-file
sudo apt-file update

# What package provides mount.nfs
sudo apt-file search mount.nfs

# Found it... let's install it
sudo apt install nfs-common