# Blade setup instructions with CM4

# First time setup


1. Flash USB with raspbian via raspberry pi imager

   
   1. Don’t forget to enable ssh access in the customization options
2. Boot blade from USB, when you use the USB for the first time it will reboot a few times
3. Login via SSH

## Updating the eeprom and boot order


1. Edit the `/boot/firmware/config.txt` `[cm4]` section by adding the following lines:

   
   1. ```bash
      [cm4]
      dtparam=spi=on
      dtoverlay=audremap
      dtoverlay=spi-gpio40-45
      ```
   2. Edit `/etc/default/rpi-eeprom-update` by adding the following two lines:

      ```bash
      RPI_EEPROM_USE_FLASHROM=1
      CM4_ENABLE_RPI_EEPROM_UPDATE=1
      ```
2. Reboot to apply the settings, then update the firmware:

   ```bash
   sudo rpi-eeprom-update -a
   ```
3. Change the boot order by executing `sudo rpi-eeprom-config --edit`  and changing the `boot-order` value to `0xf26541`:

   ```bash
   BOOT_ORDER=0xf26541
   ```

   
   1. This sets the boot order to

      
      1. SD card
      2. USB-MSD
      3. BCM-USB-MSD
      4. NVME
      5. PXE
   2. See docs <https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#BOOT_ORDER>

## Update firmware and install Talos


1. Update firmware using `fwupd`

   ```bash
   sudo apt install -y fwdupd
   fwupdmgr refresh  # Refresh database
   fwupdmgr update   # See if there are devices with updates available
   fwupdmgr upgrade  # Perform upgrade if yes
   sudo reboot
   ```
2. Find the correct Talos image to download by using the [Talos Image Factory](https://factory.talos.dev/). For CM4 with linux-utils and nfsd extensions on Talos 10.10.5 this was:

   ```bash
   wget https://factory.talos.dev/image/18ecdc1c8b2e63a565b92a194b2a7934519a69fb40177960e7fb81354ad1a692/v1.10.5/metal-arm64.raw.xz
   ```
3. Extract the image

   ```bash
   xz -d metal-arm64.raw.xz
   ```
4. Write the image 

   ```bash
   sudo dd if=metal-arm64.raw of=/dev/nvme0n1 bs=4M status=progress conv=fsync
   ```
5. Power down, remove the USB drive, and power back up. From here you can follow the usual Talos setup guides

## Second time setup

In case you have more than one blade you may re-use the USB stick we just setup. Grab your fresh blade, insert the USB stick and repeat from step 2.2