Thursday, 18 May 2023

Nezha : Ubuntu rises from the ashes

 Intro

In April I was looking into using FEL mode on nezha and I was experimenting with using a SD card to boot into FEL mode.  The investigation didn't go well and resulted in a number of failed attempts with a selection of SD cards.  As frustration increased, almost inevitably, I overwrote my working system SD card with a duff image making it unuseable.  Luckily the Linux partition could be mounted on another system and I was able to copy off my data which comprised all my Risc-v assembly programming endeavours.  I then set about building a new linux environment for the Nezha

Ubuntu

I had a number of choices available to me.

  • The original Sipeed Debian 0.3 release from May 2021
    Unfortunately this image is no longer updateable
  • RVBoads 0.5 image
    This is the image I was using and which was destroyed.
    I knew the image I was using was not updateable, and a new copy I created had the same problem.
  • RedHat Fedora
    I don't really want to start using Fedora again
  • Ubuntu
    Sunxi provided links to some D1/Nezha Ubuntu images, in particular 22.04 and 22.10
    On investigating the Ubuntu Risc-V downloads for D1 I found there was a brand new 23.04 release.
    Initially I installed the 23.04 release but found it extremely slow.
Finally I settled on installing Ubuntu 22.10 release from the list provided by sunxi which appears to work well.

Installation


The Ubuntu 22.10 image doesn't require the strange Allwinner Phoenix SD card creation tool.  I simply used the linux dd utility to copy the image to an SD card.

I connected an FTDI cable to the serial pins, thoughtfully provided and labelled on Nezha

I could then boot up the SD card and was somewhat excited to see it burst into life:


After quite a while (7.5 minutes) the login prompt was displayed.
Subsequent startups were still quite slow (about 3 minutes) and login is very slow but the system behaves well once you are logged in.
By default there isn't a desktop GUI, which is fine by me.  Even if I wanted one it would be sluggish on the Nezha.

Configuration

As usual I setup a static IP address.  I haven't used Ubuntu before and needed to familiarise myself with the netplan command line tool for setup.
I could then copy SSH keys across from Windows so that I have automatic login from WSL.

As 22.10 is an older release there were lots of updates to apply (111 packages) however the process went slowly but smoothly.  I was also given the option to update to 23.04 but I declined.

Other software installed:
lighttpd - my favoured simple webserver
samba - to easily swap files with windows; I map a drive in Windows to /root/sambashare for copies.
gcc - not installed by default, I need it for my risc-v C and assembly lessons.

Restore

Once I was happy with my system I could restore my C and assembly programs and related libraries.  My system is now back to life, with its data and in good health with updateable software.


No comments:

Post a Comment