Difference between revisions of "XUELK-AN-004: Running OpenWrt distribution"

From DAVE Developer's Wiki
Jump to: navigation, search
(Donwloading, configuring and building)
(Mounting the OpenWrt file system on the target)
Line 58: Line 58:
 
sudo cp -aRv build_dir/target-arm_cortex-a7+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708/* /opt/nfsroot/openwrt/root-brcm2708/
 
sudo cp -aRv build_dir/target-arm_cortex-a7+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708/* /opt/nfsroot/openwrt/root-brcm2708/
 
</pre>
 
</pre>
Boot the target using Yocto root file system as root file system, mounted over NFS. Once they target has completed the boot process, mount the directory including OpenWrt root file system, and the <code>ext3</code> partition of the microSD card.
+
Boot the target using Yocto root file system as root file system, mounted over NFS. Once they target has completed the boot process, mount the directory including OpenWrt root file system.
 
<pre>
 
<pre>
 
...
 
...
Line 67: Line 67:
 
root@sbc-lynx:~# mkdir /mnt/tmp
 
root@sbc-lynx:~# mkdir /mnt/tmp
 
root@sbc-lynx:~# mkdir /mnt/tmp2
 
root@sbc-lynx:~# mkdir /mnt/tmp2
root@sbc-lynx:~# history | grep mount
+
root@sbc-lynx:~# mount 192.168.0.80:/opt/nfsroot/openwrt/root-brcm2708 /mnt/tmp2
 +
</pre>
 +
 
 +
Then mount the <code>ext3</code> partition of the microSD card.
 +
<pre>
 
root@sbc-lynx:~# mount -t auto /dev/mmcblk0p2 /mnt/tmp/
 
root@sbc-lynx:~# mount -t auto /dev/mmcblk0p2 /mnt/tmp/
root@sbc-lynx:~# mount 192.168.0.80:/opt/nfsroot/openwrt/root-brcm2708 /mnt/tmp2
+
</pre>
 +
Erase all of the files it cointains.
 +
<pre>
 +
root@sbc-lynx:~# rm -rf /mnt/tmp/*
 +
</pre>
 +
Copy the files of the OpenWrt file systems into the <code>ext4</code> partition of the microSD card.
 +
<pre>
 
root@sbc-lynx:~# cp -aRv /mnt/tmp2/* /mnt/tmp
 
root@sbc-lynx:~# cp -aRv /mnt/tmp2/* /mnt/tmp
 
'/mnt/tmp2/bin/uclient-fetch' -> '/mnt/tmp/bin/uclient-fetch'
 
'/mnt/tmp2/bin/uclient-fetch' -> '/mnt/tmp/bin/uclient-fetch'
Line 78: Line 88:
 
root@sbc-lynx:~# sync
 
root@sbc-lynx:~# sync
 
</pre>
 
</pre>
 +
 
==Booting with OpenWrt root file system==
 
==Booting with OpenWrt root file system==
 
That target can be rebooted with the [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#Target_setup_and_first_boot|default configuration]], in order to mount the root file system from the <code>ext3</code> partition of the microSD card:
 
That target can be rebooted with the [[AXEL_ULite_and_SBC_Lynx_Embedded_Linux_Kit_(XUELK)#Target_setup_and_first_boot|default configuration]], in order to mount the root file system from the <code>ext3</code> partition of the microSD card:

Revision as of 14:43, 21 February 2017

Info Box
SBC Lynx-top.png Applies to SBC Lynx

History[edit | edit source]

Version Date Notes
1.0.0 February 2017 First public release

Introduction[edit | edit source]

By default, AXEL ULite and SBC Lynx Embedded Linux Kit (XUELK) comes with a Yocto distribution. Nevertheless, other distributions can be used as well. This application note shows how to run one of them, OpenWrt.

Generally speaking, OpenWrt is particularly suited for networking devices such as routers and access points. As such, it can be very useful when used in combination with SBC Lynx, to address networking-related use cases.

An exhaustive discussion of OpenWrt is beyond the scope of this application note. For more information, please refer to the project's home page.

The test bed used for this application note is composed of the same hardware/software platform delivered along with the XUELK. The only relevant difference is related to the root file system. The default one will be replaced with the one generated by the OpenWrt build process, as described in the follwing sections.

Donwloading, configuring and building[edit | edit source]

The following commands can be used to generate a root file system for ARM Cortex-A7 target, such as SBC Lynx.

First of all, download the required files:

git clone https://github.com/openwrt/openwrt.git
cd openwrt/
./scripts/feeds update -a
./scripts/feeds install -a

Enter the configuration menu in order to select the proper Target System and Subtarget

make menuconfig

as shown in the following pictures.

Target System selection
Subtarget selection

Start the build process:

make defconfig
make V=s

Once the build process is completed, the root file system is available in the openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708 subdirectory.

Mounting the OpenWrt file system on the target[edit | edit source]

It seems that the OpenWrt file system does not work if mounted over NFS. To overcome this hurdle, we can copy the file system to the ext3 partition of the microSD card.

On host side, make the OpenWrt file system available for the NFS mount. In the following example, the /opt/nfsroot directory - and its subdirectories - is exported.

mkdir /opt/nfsroot/openwrt/root-brcm2708
sudo cp -aRv build_dir/target-arm_cortex-a7+neon-vfpv4_musl-1.1.16_eabi/root-brcm2708/* /opt/nfsroot/openwrt/root-brcm2708/

Boot the target using Yocto root file system as root file system, mounted over NFS. Once they target has completed the boot process, mount the directory including OpenWrt root file system.

...
Freescale i.MX Release Distro 3.14.52-1.1.1 sbc-lynx /dev/ttymxc0

sbc-lynx login: root
Password:
root@sbc-lynx:~# mkdir /mnt/tmp
root@sbc-lynx:~# mkdir /mnt/tmp2
root@sbc-lynx:~# mount 192.168.0.80:/opt/nfsroot/openwrt/root-brcm2708 /mnt/tmp2

Then mount the ext3 partition of the microSD card.

root@sbc-lynx:~# mount -t auto /dev/mmcblk0p2 /mnt/tmp/

Erase all of the files it cointains.

root@sbc-lynx:~# rm -rf /mnt/tmp/*

Copy the files of the OpenWrt file systems into the ext4 partition of the microSD card.

root@sbc-lynx:~# cp -aRv /mnt/tmp2/* /mnt/tmp
'/mnt/tmp2/bin/uclient-fetch' -> '/mnt/tmp/bin/uclient-fetch'
'/mnt/tmp2/bin/busybox' -> '/mnt/tmp/bin/busybox'
...
'/mnt/tmp2/usr' -> '/mnt/tmp/usr'
'/mnt/tmp2/www' -> '/mnt/tmp/www'
root@sbc-lynx:~# sync

Booting with OpenWrt root file system[edit | edit source]

That target can be rebooted with the default configuration, in order to mount the root file system from the ext3 partition of the microSD card:

...
[    4.678749] ALSA device list:
[    4.681760]   No soundcards found.
[    4.703985] kjournald starting.  Commit interval 5 seconds
[    5.920798] EXT3-fs (mmcblk0p2): using internal journal
[    5.926397] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
[    5.933439] VFS: Mounted root (ext3 filesystem) on device 179:2.
[    5.944702] devtmpfs: mounted
[    5.948500] Freeing unused kernel memory: 408K (80b15000 - 80b7b000)
[    6.044422] init: Console is alive
[    6.048397] init: - watchdog -
[    6.062608] init: - preinit -
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[    9.366671] mount_root: mounting /dev/root
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
[   10.946355] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   10.967107] procd: - early -
[   10.970194] procd: - watchdog -
[   11.757354] procd: - ubus -
[   11.821973] procd: - init -
Please press Enter to activate this console.



BusyBox v1.24.2 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 DESIGNATED DRIVER (Bleeding Edge, 50104)
 -----------------------------------------------------
  * 2 oz. Orange Juice         Combine all juices in a
  * 2 oz. Pineapple Juice      tall glass filled with
  * 2 oz. Grapefruit Juice     ice, stir well.
  * 2 oz. Cranberry Juice
 -----------------------------------------------------
root@OpenWrt:/#