Ok, just confirmed that imagebuilder does not support writing to the /boot partition using FILES=.
I grabbed the x86/64 imagebuilder, untarred it, then made a handful of dummy test files:
$ find files/ -type f
files/boot/grub/grub.cfg
files/etc/uci-defaults/00_hello
files/etc/bort/o-hello
Run a build (verbose with logging so I could look at the voluminous output):
$ make image FILES=files V=sc -j1 > build.log 2>&1
Resulting in the /etc files being created on the rootfs (cat confirms they are as expected).
$ find -name '*hello'
./build_dir/target-x86_64_musl/root-x86/etc/uci-defaults/00_hello
./build_dir/target-x86_64_musl/root-x86/etc/bort/o-hello
./files/etc/uci-defaults/00_hello
./files/etc/bort/o-hello
But the grub.cfg is either ignored or overwritten by the imagebuilder's grub scripts:
$ find -name grub.cfg | xargs wc -l
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined.img.gz.boot/boot/grub/grub.cfg
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-ext4-combined.img.gz.boot/boot/grub/grub.cfg
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-targz-combined.img.gz.boot/boot/grub/grub.cfg
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-squashfs-combined-efi.img.gz.boot/boot/grub/grub.cfg
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-ext4-combined-efi.img.gz.boot/boot/grub/grub.cfg
13 ./build_dir/target-x86_64_musl/linux-x86_64/tmp/openwrt-x86-64-generic-targz-combined-efi.img.gz.boot/boot/grub/grub.cfg
1 ./files/boot/grub/grub.cfg
So, in order to effect any change in the installed grub.cfg, we'd need to hack one/all of the templates, or add some make variable and rewrite the code here to inject something while running the templates.
Templates here:
$ find -name 'grub-*.cfg'
./target/linux/x86/image/grub-efi.cfg
./target/linux/x86/image/grub-iso.cfg
./target/linux/x86/image/grub-pc.cfg
They all look pretty much like this:
$ cat ./target/linux/x86/image/grub-efi.cfg
@SERIAL_CONFIG@
@TERMINAL_CONFIG@
set default="0"
set timeout="@TIMEOUT@"
search -l kernel -s root
menuentry "@TITLE@" {
linux /boot/vmlinuz @GPT_ROOTPART@ @CMDLINE@ noinitrd
}
menuentry "@TITLE@ (failsafe)" {
linux /boot/vmlinuz failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd
}