* [Buildroot] [PATCH 2/2] board/pc/post-build.sh: allow to use grub config file
@ 2023-01-09 7:42 AndreiCherniaev
2023-10-01 17:08 ` Yann E. MORIN
0 siblings, 1 reply; 2+ messages in thread
From: AndreiCherniaev @ 2023-01-09 7:42 UTC (permalink / raw)
To: buildroot
Allow to use grub config file with set timeout not default. Before this set timeout always was 5s and can't be changed, any set timeout from BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC was ignored
Signed-off-by: AndreiCherniaev <cherniaev.andrei@kairo.space>
---
board/pc/post-build.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/board/pc/post-build.sh b/board/pc/post-build.sh
index c76dee2676..8538faa7eb 100755
--- a/board/pc/post-build.sh
+++ b/board/pc/post-build.sh
@@ -9,7 +9,22 @@ if [ -d "$BINARIES_DIR/efi-part/" ]; then
cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
else
cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg"
-
# Copy grub 1st stage to binaries, required for genimage
cp -f "$TARGET_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR"
fi
+
+# When post-build script is runing $BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC is unset, so parce Buildroot .config file again
+GRUB2_BUILTIN_CONFIG_PC="`grep --only-matching --perl-regex "(?<=BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC\=).*" $BR2_CONFIG`"
+# Using the native shell prefix/suffix removal feature (see also qstrip)
+GRUB2_BUILTIN_CONFIG_PC="${GRUB2_BUILTIN_CONFIG_PC%\"}"
+GRUB2_BUILTIN_CONFIG_PC="${GRUB2_BUILTIN_CONFIG_PC#\"}"
+if [ -z "$GRUB2_BUILTIN_CONFIG_PC" ]; then #if user doesn't use his .config for grub
+ # Set time to wait 5 s for keyboard input before booting by default
+ sed -i -e '1 s/^/set default="0"\nset timeout="5"\n\n/;' "$TARGET_DIR/boot/grub/grub.cfg"
+#else if user use his .config for grub
+# to configure bootloader put something like
+# set default="0"
+# set timeout="5"
+# to your file located $BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC
+# More info https://www.gnu.org/software/grub/manual/grub
+fi
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Buildroot] [PATCH 2/2] board/pc/post-build.sh: allow to use grub config file
2023-01-09 7:42 [Buildroot] [PATCH 2/2] board/pc/post-build.sh: allow to use grub config file AndreiCherniaev
@ 2023-10-01 17:08 ` Yann E. MORIN
0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2023-10-01 17:08 UTC (permalink / raw)
To: AndreiCherniaev; +Cc: buildroot
Andrei, All,
Sorry to come back so alte on that patch...
On 2023-01-09 16:42 +0900, AndreiCherniaev spake thusly:
> Allow to use grub config file with set timeout not default. Before this set timeout always was 5s and can't be changed, any set timeout from BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC was ignored
Please properly format your commit log, wrapped at ~72 chars wide lines.
The files in board/ are meant to be used with the defconfigs in
Buildroot, and together are meant as examples and startkng point for
frther custmisations.
We can't add support for everything up to the kitchen sink in those
scripts; we want to keep them simple so that it is easy to see what they
are doing on how they can be extended.
It is your responsibility to adapt those files to match your use-case,
potentially duplicating them on hyour side to create a new board
definition.
As such, I've maked this patch as rejected.
Regards,
Yann E. MORIN.
> Signed-off-by: AndreiCherniaev <cherniaev.andrei@kairo.space>
> ---
> board/pc/post-build.sh | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/board/pc/post-build.sh b/board/pc/post-build.sh
> index c76dee2676..8538faa7eb 100755
> --- a/board/pc/post-build.sh
> +++ b/board/pc/post-build.sh
> @@ -9,7 +9,22 @@ if [ -d "$BINARIES_DIR/efi-part/" ]; then
> cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
> else
> cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg"
> -
> # Copy grub 1st stage to binaries, required for genimage
> cp -f "$TARGET_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR"
> fi
> +
> +# When post-build script is runing $BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC is unset, so parce Buildroot .config file again
> +GRUB2_BUILTIN_CONFIG_PC="`grep --only-matching --perl-regex "(?<=BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC\=).*" $BR2_CONFIG`"
> +# Using the native shell prefix/suffix removal feature (see also qstrip)
> +GRUB2_BUILTIN_CONFIG_PC="${GRUB2_BUILTIN_CONFIG_PC%\"}"
> +GRUB2_BUILTIN_CONFIG_PC="${GRUB2_BUILTIN_CONFIG_PC#\"}"
> +if [ -z "$GRUB2_BUILTIN_CONFIG_PC" ]; then #if user doesn't use his .config for grub
> + # Set time to wait 5 s for keyboard input before booting by default
> + sed -i -e '1 s/^/set default="0"\nset timeout="5"\n\n/;' "$TARGET_DIR/boot/grub/grub.cfg"
> +#else if user use his .config for grub
> +# to configure bootloader put something like
> +# set default="0"
> +# set timeout="5"
> +# to your file located $BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC
> +# More info https://www.gnu.org/software/grub/manual/grub
> +fi
> --
> 2.34.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-01 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 7:42 [Buildroot] [PATCH 2/2] board/pc/post-build.sh: allow to use grub config file AndreiCherniaev
2023-10-01 17:08 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox