Changes

Jump to: navigation, search

Embedded Linux tips and tricks

4,939 bytes added, 10:48, 14 March 2022
no edit summary
__FORCETOC__
 
==Introduction==
This page provides examples and usage notes for common tasks/issues related to typical embedded Linux systems.
 
==How to write <code>.wic</code> image files to SD cards==
[https://www.yoctoproject.org/ Yocto] build system can generate [https://www.yoctoproject.org/docs/2.4.2/dev-manual/dev-manual.html#creating-partitioned-images-using-wic <code>.wic</code> image files]. These files are usually written to SD cards to create bootable devices.
 
The simplest way to write such images to SD cards is to use the [https://www.balena.io/etcher/ Balena Etcher] tool, which is available for Linux, macOS, and Windows hosts. Using Etcher is straightforward, nonetheless many tutorials and examples are available on the Internet.
 
Advanced users can also use the well-known [https://en.wikipedia.org/wiki/Dd_(Unix) <code>dd</code>] utility. This tool should be avoided unless the user knows what they are doing. If the target device is not specified properly, <code>dd</code> can wipe out all the data on a host's disk drive! For more details, see for instance [https://opensource.com/article/18/7/how-use-dd-linux this article].
 
==Setting up a Yocto prebuilt package repository for <code>apt</code>==
Occasionally, it is convenient to set up the target for installing <code>.deb</code> packages retrieved from a Yocto repository. The following example shows how to do that on an [[ORCA_SOM|ORCA SOM]]-based target.
The repository used is located at http://yocto.dave.eu/imx-5.4.70-2.3.0/. The prebuilt packages were generated by Yocto Zeus, which was used to create the distro running on the target as well.
 
===Configuring the network subsystem===
First of all, it is necessary to configure the target's network subsystem in order to access the Internet. In this example, a couple of <code>systemd</code> services are used for this purpose, namely <code>systemd-networkd</code> and <code>systemd-resolved</code>. They were configured by following these steps.
 
Disable the Connection Manager (ConnMan) sevice to prevent conflict issues:
<pre class="board-terminal">
</pre>
 
Create the configuration file for the network interface of interest (<code>eth1</code> in the example):
<pre class="board-terminal">
</pre>
 
Start <code>systemd-networkd</code> and <code>systemd-resolved</code>:
<pre class="board-terminal">
</pre>
 
Both services should be active:
<pre class="board-terminal">
root@orca:~# systemctl status systemd-networkd
* systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-12-15 21:34:32 UTC; 18s ago
Docs: man:systemd-networkd.service(8)
Main PID: 534 (systemd-network)
Status: "Processing requests..."
Tasks: 1
Memory: 2.0M
CGroup: /system.slice/systemd-networkd.service
`-534 /lib/systemd/systemd-networkd
 
Dec 15 21:34:32 orca systemd[1]: Starting Network Service...
Dec 15 21:34:32 orca systemd-networkd[534]: Enumeration completed
Dec 15 21:34:32 orca systemd[1]: Started Network Service.
Dec 15 21:34:32 orca systemd-networkd[534]: eth1: IPv6 successfully enabled
Dec 15 21:34:32 orca systemd-networkd[534]: eth0: IPv6 successfully enabled
Dec 15 21:34:36 orca systemd-networkd[534]: eth1: Gained carrier
Dec 15 21:34:38 orca systemd-networkd[534]: eth1: Gained IPv6LL
Dec 15 21:34:50 orca systemd-networkd[534]: eth1: Configured
root@orca:~# systemctl status systemd-resolved
* systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-12-15 21:34:32 UTC; 6s ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 542 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1
Memory: 1.4M
CGroup: /system.slice/systemd-resolved.service
`-542 /lib/systemd/systemd-resolved
 
Dec 15 21:34:32 orca systemd[1]: Starting Network Name Resolution...
Dec 15 21:34:32 orca systemd-resolved[542]: Positive Trust Anchors:
Dec 15 21:34:32 orca systemd-resolved[542]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
Dec 15 21:34:32 orca systemd-resolved[542]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Dec 15 21:34:32 orca systemd-resolved[542]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa>
Dec 15 21:34:32 orca systemd-resolved[542]: Using system hostname 'orca'.
Dec 15 21:34:32 orca systemd[1]: Started Network Name Resolution.
</pre>
===Configuring <code>apt</code>===
Edit the file <code>/etc/apt/apt.conf</code> like this:
<pre class="board-terminal">
Acquire::Languages "none";
</pre>
 
Edit the file <code>/etc/apt/sources.list.d/debian-10.list</code> like this:
4,650
edits

Navigation menu