Rebuilding my Ability to Build MiniDexed

I do all of my non-Arduino C related development in an Ubuntu Linux virtual machine and managed to trash it recently (don’t ask).  I have several posts that detail how I got up and running with some of the environments I needed, but didn’t have the notes from my first experiments with MiniDexed, so this post is my “notes to self” for getting (re)started with MiniDexed.

For reference, the other development environments I have are described in the following:

Installing Ubuntu Linux in a Virtual Machine

I use VMware Player which is free for non-commercial use. When a new virtual machine is created it is fairly easy to map onto an ISO image of the latest LTS version of Ubuntu to use as the installation media.

I’m not going to go through how to setup a VM or install Ubuntu, but I did a fairly standard install and just upped the memory and disk requirements for the virtual machine.

One extra I always forget to do – change the language to English (UK) and the keyboard layout to the same!

Once installed, it is worth checking for any updates (although this will largely happen on its own eventually):

$ sudo apt-get update
$ sudo apt-get upgrade

Extras and Building Circle

Although probably not required for MiniDexed itself, I first got everything to the point of being able to git clone circle and build a sample application. All the details of how to do that can be found in the following post, so I won’t repeat that here:

In addition to the development tools I made sure I’d installed notepadqq and git. I’ll come back to setting up git in a moment, but having it installed is enough to be able to clone repositories.

Installing the MiniDexed Enviroment

There are instructions for how to get started with MiniDexed development on the wiki on the following link:

It isn’t totally clear to me, but these were the main steps I went through.

1. Download and install the development tool chain.

$ mkdir src
$ cd src
$ wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
$ tar xf *-aarch64-none-elf.tar.xz

2. Set up the path and environment for building using the above toolchain. This means adding the following to the bottom of the ~/.bashrc file.

export PATH=$(readlink -f $HOME/src/gcc-*aarch64-none*/bin):$PATH
export RPI=3

Adding RPI=3 is just a convenience as it will need to be set every time MiniDexed is built. I tend to build for the V3 RPi as it is more convenient to debug via HDMI and power over micro-USB, but occasionally I also use RPI=1 or RPI=4 too.

Note: I might need an extra step for the toolchain for the RPi V1. If so, I’ll come back and update this post when I get that far.

3. Clone MiniDexed and any submodules.

$ git clone https://github.com/probonopd/MiniDexed
$ cd MiniDexed
$ git submodule update --init --recursive

$ ./submod.sh

If I’m getting ready for my own development then I’ll actually use the following git clone command:

$ git clone git@github.com:diyelectromusic/MiniDexed.git

This is doing two things: it is linking my local repo to my own fork on GitHub and it is setting the default access to GitHub to be over SSH rather than HTTPS. I’ll get into how that needs to be set up shortly.

4. Perform a test build – open a new terminal and run build.sh.

$ cd MiniDexed
$ ./build.sh

Configuring GitHub

Before git can be used, the username and email must be configured as follows:

$ git config --global user.name MyName
$ git config --global user.email 12345678+mygithubusername@users.noreply.github.com

I have GitHub configured to keep my email private (not a big deal, and hasn’t always been the case, but seems like a prudent step) so I use my GitHub “noreply” email here too, which can be found in GitHub settings.

Setting up GitHub for SSH Access

There are two ways to access remote repositories on GitHub from the Linux command line: HTTPS and SSH. Advice on which to use seems to vary, but I believe HTTPS is considered simpler for more basic use. Personally I find that now that GitHub has retired basic password authentication, HTTPS is actually quite a pain, so I’ve switched to using SSH.

For completeness though, to use HTTPS now requires the use of a Personal Access Token which is something you create from your github.com account and then use from the command line. Details of how to do that can be found here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

To set up SSH requires the creation of a public/private key pair on the Linux machine with the public part then getting added to your GitHub account. More details on how to do that can be found here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

The simple version (i.e. for my own personal reference and future prompting!) is to perform the following:

$ ssh-keygen -t ed25519 -C "diyelectromusic@github"
$ ssh-add ~/.ssh/id_ed25519

This will prompt for a file to store the keys (default is fine) and a pass phrase that will be used to locally secure access to the keys (strongly recommended). The keys will now stored in the files .ssh/id_ed25519 and .ssh/id_ed25519.pub. Note that the last bit is just a label, but many will use an email address here. The second command will add the keys to the SSH agent.

To add the key to GitHub, find “Settings” -> “SSH and GPG Keys” and use “New SSH Key” to add the contents of the id_ed25519.pub file, which will look something like this:

ssh-ed25519 <chunk of alphanumeric data>

If a repository has already been cloned using HTTPS then it can be switched over to SSH using the following:

$ git remote set-url origin git@github.com:mygithubusername/repo.git

Closing Thoughts

I am now back up and running. Thankfully I was already at a point where everything I’d been doing was stored in a branch on GitHub.com so all the actual code was ready to pull down again. It just meant I lost a few test builds annd some random messing around. Probably not a bad thing really.

Kevin

Leave a comment