Skip to content
View in the app

A better way to browse. Learn more.

Learn more

Recommanded ways to change the default overlays at build time

Featured Replies

Hi!

I need to use the UART1 port on my NanoPi NEO. This usually means just adding "uart1" to the `overlays` in `/boot/armbianEnv.txt`.
What I would like to do is build a custom image that already has the overlay activated by default.

I read the following documentations:
- https://docs.armbian.com/User-Guide_Armbian_overlays/

- https://docs.armbian.com/Developer-Guide_User-Configurations/

 

But couldn't find anything about it.
At first I tried to define the `DEFAULT_OVERLAYS` env var in `userpatches/config-example.conf` since I noticed it was defined in the configuration for the board, but it didn't work.
 

I manage to make it work by modifying the `armbianEnv.txt` file within the `customize-image.sh` script, using some sed magic. For exemple:
 

RELEASE=$1
LINUXFAMILY=$2
BOARD=$3
BUILD_DESKTOP=$4

Main() {
        echo "Release: $RELEASE"
        case $RELEASE in
                jammy)
                        DisplayArmbianBootConf
                        ;;
        esac
} # Main

DisplayArmbianBootConf() {
echo "Adding UART1 overlay"
sed -i '/overlays/s/$/ uart1/' /boot/armbianEnv.txt
echo "armbianEnv.txt: "
cat /boot/armbianEnv.txt
echo "UART1 added."
}

 

Now this works fine, but it feels a bit "hackish".
So I was wondering, is there a better way to achieve this ? This I miss an env var, conf file or specific configuration which would allow me to append overlays to the default overlay of the board ?

Thanks,

Solved by schwar3kat

  • Solution
6 hours ago, Maël said:

I manage to make it work by modifying the `armbianEnv.txt` file within the `customize-image.sh` script, using some sed magic. For exemple:


In my opinion, for what it's worth :), that's exactly the sort of thing customize-image.sh is intended to be used for.  
It's arguably less "hackish" than many other hacks, because it is intended for the purpose.

  • Author

Hello !


In this case, and seeing that no one else propose a better solution, I will mark you answer a solution.

It's a bit sad that the board configuration do define a `DEFAULT_OVERLAYS` but it doesn't seem that we can override it.

But the customize-image.sh solution do work pretty well, so definitely not a big deal.

 

Thanks :)

Guest
This topic is now closed to further replies.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.