Jump to content

Recommanded ways to change the default overlays at build time


Maël
Go to solution Solved by schwar3kat,

Recommended Posts

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,

Link to comment
Share on other sites

  • 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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines