Back | Next | Contents
Building Embedded Linux - Full Custom
Table of Contents generated with DocToc
- Summary
- Compile the kernel driver
- Copy the module to the FAT partition of the SD card
- Install the necessary firmware
- Device configuration
- References
If you've followed the steps with building Debian as shown earlier, the ethernet should work out of the box. Just plug in a LAN cable and it should work.
But if you want to use a WIFI module, there are some more steps that are needed. Here we'll go through the steps to get wifi working for the RT5370 chipset and specifically this USB Wifi module. Nothing special about it, I just bought it along with my de10-nano board and hence I'm explaining it here.
If you own a different wifi module, your steps may vary a bit. But if you get it working I would appreciate it if you could document it and send a pull request to document it here for everyones benefit.
The first step is to enable the WIFI driver in the kernel. The steps listed here are taken from this forum post on element14.
cd $DEWD
cd linux-socfpga
make ARCH=arm menuconfig
First step is to enable mac80211 linux stack for wireless lan. This will make RT5370 drivers available in menuconfig. This can be enabled as shown in the screenshot below:
Next, follow the chain as shown below and enable the option at every step to be compiled along with the kernel i.e. it should have an asterisk *
and not an M
. For this, press Y
on the option to force it to be included in the kernel image. This is shown below:
Once completed, press right and select exit on all the screens and select the option to save when it asks you.
Back on the terminal, compile the kernel image with the following command (same as before):
make ARCH=arm LOCALVERSION=zImage -j 24
You need to replace the zImage file in the FAT partition of the SD card. You can do this either by plugging the SD card to your computer and replacing it, or using scp
to copy it to your already running de10-nano, mounting the FAT partition and replacing the kernel image file. I think this is pretty straightforward, so won't go through it in detail.
The steps from here on require the de10-nano to be connected to the internet via a LAN cable.
Interestingly, the required firmware for this WIFI dongle needs to be installed separately. For this, we need to install the following package on the de10-nano. This may be different if you are using a different device. Remember to ssh into the device or login with the serial port:
apt update
apt install firmware-ralink
Now we have the firmware and the drivers in place. We're not out of the woods yet, still need to configure the device.
All the steps below require you to have an active root terminal on the de10-nano and perform them there.
It's supposed to work without using this, but I couldn't get it to work. So I'll just document the part with wpa-supplicant. First, let's install it:
apt install wireless-tools -y
apt install wpasupplicant -y
Run the following command to configure wpa-supplicant:
wpa_passphrase <myssid> <mypassword> > /etc/wpa_supplicant/wpa_supplicant.conf
Remember to replace <myssid>
and <mypassword>
with the WIFI name and password for your home. I'm assuming you use WPA2.
Check the config file to see it created correctly:
cat /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="myssid"
#psk="mypassword"
psk=1bc4ebbasdf9b365dbf3adfd12asdfbd891d8e67f3e3dfb1013bc9c3f9c8c127
}
Copy the long string psk
and save it somewhere. We'll use it in the next step.
Open the interfaces file and update it as follows. Note that if you see a line saying auto eth0
, you should replace it with allow-hotplug eth0
. Otherwise you might see a message at bootup saying "A start job is running to raise network" which can take 5 mins.
vim /etc/network/interfaces
source-directory /etc/network/interfaces.d
auto lo eth0
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
# Wifi config.
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid myssid
wpa-psk 1bc4ebbasdf9b365dbf3adfd12asdfbd891d8e67f3e3dfb1013bc9c3f9c8c127
The Wifi config section in the file above ensures the wifi module is started at boot time.
The last step is to enable the wpa_supplicant service to start at boot time. This is done with the following command:
systemctl reenable wpa_supplicant.service
For some reason the device name of my wifi card keeps getting renamed from wlan0 to something obscure which prevents it from working. To fix this, I need to add net.ifnames=0
to the kernel boot parameters in extlinux.conf
as shown below:
LABEL Linux Default
KERNEL ../zImage
FDT ../socfpga_cyclone5_de0_nano_soc.dtb
APPEND root=/dev/mmcblk0p2 rw rootwait earlyprintk console=ttyS0,115200n8 net.ifnames=0
And that's it. Hopefully if you've got the steps right, the wifi should be working now.
- This forum post on element14.
Next | Flashing the FPGA from Linux
Back | Creating the SD Card Image
Building Embedded Linux - Full Custom | Table of Contents