Best way to customize the banner

I want to create a custom banner.

I tried overwriting it from using a custom package but that only resulted a clash with the banner installed by base-files.

On that note, what is the best way to overwrite the banner on firmware build, rather than editing the original file from base-files?

Hi

if you build from scratch, there is option for custom files to be placed/prepared

/home/user/openwrt/files/etc/banner

where:
/home/user is your user dir
openwrt is folder where you git cloned source
and finally, files folder contains custom files which will be copied during compile

2 Likes

Custom files functionality explained in wiki...

4 Likes

But if you do this then the % options are not populated in the banner file:

> 
>   _______                     ________        __
>  |       |.-----.-----.-----.|  |  |  |.----.|  |_
>  |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
>  |_______||   __|_____|__|__||________||__|  |____|
>           |__| W I R E L E S S   F R E E D O M
>  -----------------------------------------------------
>  %D %V, %C
>  -----------------------------------------------------

I assume you are looking to achieve something similar to this?

BusyBox v1.36.1 (2024-11-27 11:45:39 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 Openwrt One - Build 004 r28200+5-c857145e03, 11-27-2024 SNAPSHOT
 -----------------------------------------------------

I achieve this by branding my builds from source using make nconfig/menuconfig > Image configuration > Version configuration options

--- Version configuration options
 (Openwrt One - Build 005) Release distribution
 (r28363+5-f10ee1e209) Release version number
 (12-21-2024 SNAPSHOT) Release version code
 (https://downloads.openwrt.org/snapshots) Release repository
 ()    Release Homepage
 (BPi) Manufacturer name
 (https://openwrt.org/) Manufacturer URL
 ()    Bug reporting URL
 (https://one.openwrt.org/sources/) Support URL
 (OpenWrt One) Product name
 (V0)  Hardware revision

You already know that you need to compile with the full toolchain, right?

In addition to passing % values via config options, you can directly patch the text file in base-file sources. package/base-files/files/etc/banner

The available % variables are listed in version.mk

2 Likes

Yes, that is the correct way to do this - you must patch base-files.
My point was placing a file in /home/user/openwrt/files/etc/banner will NOT expand the % items.

With all due respect. All the responses to the two queries are correct.

@npeca75 explained how to add a customized static banner file into the build system that would be incorporated into the OP’s device firmware. @hnyman provide an adjunct to that response.

I explained how to use the toolchain variables in the .config to achieve a similar result in your eventual firmware and @hnyman provided further context to my response as well as explaining you could also just patch the file in the build environment.

Build system variables exist only within the toolchain/build system environment, not in your user space environment.