Arch Linux ARM on Orange Pi 5 Max: Part 2


The journey continues with getting some of the base packages installed and getting things configured to a good state.

The goal is to keep the bloat off, install what I need to meet the requirements and try not to break the OS before updating the kernel.

Yesterday, the install was successful, and everything seemed to flow smoothly. There will be rough waters ahead, so the goal is to keep it simple, and focus on the requirements. Today might be a good day to get a backup of the EMMC once all of the packages are installed. (Ive never done that before, but I dont imagine it could be too terribly difficult).

Requirements

Phase 2

Install the packages needed for this project to be successful.

Starting fresh, access to the AUR will be an absolute requirement. Most of the good stuff is in the AUR, and for adventurous people who want to strap the Hailo M.2 module onto the Orange Pi 5 Max; that is where all of the supported packages are.

Lets get these packages installed. A simple Google search (and Grok) identified two packages that are an absolute for the Hailo. There might be more, but starting small is the right choice.

Both packages arent in base repo, so installation requires AUR from the start. I chose yay for my AUR helper because its simple to use and has always ‑just‐ worked.

  1. Update pacman.

    sudo pacman ‑Syyuu
  2. Install yay.

    sudo pacman ‑S yay

    Right off the bat, there are issues. These are small though. There doesnt appear to be linking requirement to the devel packages needed for compiling and installing AUR packages. These will need to be manually installed (should probably throw some other packages that might be helpful too; git, wget, p7zip).

    sudo pacman ‑S gcc make fakeroot binutils patch pkgconf autoconf automake git base‐devel bison flex gettetxt m4 git wget 7zip
  3. Once installed, start installing the other packages that are needed for the project. In this case; python, pip, cifs‐utils, smbclient, flask, etc.

    yay ‑S python python‐pip cifs‐utils smbclient python‐flask python‐astropy python‐opencv python‐pyusb usbutils python‐onnx python‐scikit‐image python‐wand imagemagick
  4. Then get the latest Hailo packages from the AUR to be able to use that accelerator chip.

    yay ‑Syua hailo‐pci hailort
  5. While going through the logs to see what was happening on the system, it appears that the stupid AP6611 module isnt fully operational yet. This is frustrating, and because power is precious in this build, it would be best to disable the module altogether.



    Disable the brcmfmac:

    sudo echo “blacklist brcmfmac” > /etc/modprobe.d/blacklist.conf
    sudo echo “blacklist brcmfmac_sdio” > /etc/modprobe.d/blacklist.conf



    Rebuild the kernel:

    sudo mkinitcpio ‑P



    Reboot and ensure that its off and the card isnt detected.

    dmesg | grep WLAN_RFKILL
    ifconfig
    nmclidevice

    Next, there needs to be a place that can be accessed across the network. Setting up a samba ‘drop box’ is probably the best solution. This coupled with inotify to monitor a folder for any activity and then trigger a script to get things going!

    Edit the /etc/samba/smb.conf file and add the following:

    [fits_incoming]
    path = /home/astro/space/fits‐incoming
    writable = yes
    guest ok = yes
    valid users = astro
    create mask = 0775
    directory mask = 0775

    Even though guests are allowed, still had to add the user to get it working:

    sudo smbpasswd ‑a astro

    Then, start the servers to get samba up and running.

    sudo systemctl start smb nmb

    Now its time to setup the monitor and notification system using inotify and a service file.

    pacman ‑S inotify‐tools

    Next is a small monitoring script to leverage inotifywait to look for fit and fits files that enter the fits‐incoming folder (from the samba share), and ignore Mac ._ files.

    Its a little premature, but add the PROCESS_SCRIPT in there because, well, thats where its going to be eventually.

    #!/bin/bash
    INCOMING_DIR=”/home/astro/space/fits-incoming”
    PROCESS_SCRIPT=”/home/astro/space/process.py”
    
    inotifywait ‑m ‑e create ‑e moved_to ‑e close_write –format ‘%w%f’ “$INCOMING_DIR” | while read ‑r file; do
    if [[ “$file” =~ \.fit(s)?$ && ! “$file” =~ \._ ]]; then
        echo “New FITS file detected: $file”
        python “$PROCESS_SCRIPT” “$file”
    fi
    done

    Then, the service file to run this script as a system service in the background.

    [Unit]
    Description=FITS file monitor
    After=network.target smbd.service
    
    [Service]
    ExecStart=/home/astro/space/monitor.sh
    Restart=always
    User=astro
    WorkingDirectory=/home/astro/space
    
    [Install]
    WantedBy=multi-user.target

    This should be a good stopping point. So far, the system has been configured, and the basic monitoring system has been incorporated automate the file management and script execution when fit files are added to the samba share. The Hailo drivers have been added, and there doesnt appear to be any issues with the Orange Pi 5 Max running with the Hailo module or other issues.