DEV Community

Daniel Guerrero
Daniel Guerrero

Posted on

Starting With Luckfox Lyra Zero W

The Luckfox Lyra Zero W is a Development Board with RK3506B Chip, Triple-core Arm Cortex-A7 and Arm Cortex-M0 Processors.

The Ubuntu image is here:
https://github.com/platima/SBC-Images/tree/main/Luckfox/Lyra/Lyra%20Zero%20W

The main issue with image is there no extra disk space so you can't do any resize operation in the same device.

So the options are:

  • Resize the img file
  • Resize the SD partition

For both operations you'll need a Linux machine to run the commands

Resize the img file

When you have the img file after bunzip it, run the following commands:

# grow the image by 7GB so final will be 8GB, change to proper SD size
dd if=/dev/zero bs=1G count=7 \
  oflag=append conv=notrunc \
  of=Luckfox_Lyra_Zero_W-2503_Ubuntu.img

sudo losetup --find --partscan \
  Luckfox_Lyra_Zero_W-2503_Ubuntu.img

# check with lsblk which loop device 
# (there will be 3 partitions)
# in my case the device is /dev/loop2
lsblk

# data is partition 3 so check for failed sectors
sudo e2fsck -y /dev/loop2p3

# grow partition
sudo growpart -v /dev/loop2 3

# resize ext4 partition
sudo resize2fs /dev/loop2p3

# unmount loop file
sudo losetup --detach /dev/loop2
Enter fullscreen mode Exit fullscreen mode

The new size of the img file will be of 8GB after this so the root will have now 7GB of free space, this is simpler as you don't need to mount the SD card, but the problem is that you will get unused space in the card.

Resize the SD card

Once you write the img to SD using a tool like Balena Etcher or Rufus, you need to do the following:

# check the device used
lsblk

# in my case is /dev/sdd

# if is automatically mounted, unmount it
sudo umount /dev/sdd3

# data is partition 3 so check for failed sectors
sudo e2fsck -y -f /dev/sdd3

# grow partition
sudo growpart -v /dev/sdd 3

# resize ext4 partition
sudo resize2fs /dev/sdd3
Enter fullscreen mode Exit fullscreen mode

Connect through USB

To connect to device, ADB tools can be used

Run adb to list devices

adb devices -l
Enter fullscreen mode Exit fullscreen mode

If a device is present, then connect:

adb shell
Enter fullscreen mode Exit fullscreen mode

WiFi setup

You need to provide the details of your network, for this edit the /etc/wpa_supplicant.conf
The original contents will be:

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1

network={
        ssid="SSID"
        psk="PASSWORD"
        key_mgmt=WPA-PSK
}
Enter fullscreen mode Exit fullscreen mode

Change the SSID and PASSWORD for the details of your WiFi network.
After that create a file /etc/network/interfaces.d/wlan0
And there are two options: dhcp (most common) or static ip

WiFi DHCP

auto wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant.conf
Enter fullscreen mode Exit fullscreen mode

WiFi Static IP

Change address, gateway and other params to your proper settings

auto wlan0
iface wlan0 inet static
    wpa-conf /etc/wpa_supplicant.conf
    address 192.168.2.100
    netmask 255.255.255.0
    gateway 192.168.2.1
Enter fullscreen mode Exit fullscreen mode

There is an issue with resolv.conf that image set to a docker nameserver, so needs to be replaced:

echo "nameserver 1.1.1.1 8.8.8.8" > /etc/resolv.conf
Enter fullscreen mode Exit fullscreen mode

Apply the config with:

systemctl restart networking
Enter fullscreen mode Exit fullscreen mode

Top comments (0)