From a7e8b649fccbad93fcef9f65c6df6f8c6b35491c Mon Sep 17 00:00:00 2001 From: Updawg <10038272+updawg@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:34:17 -0400 Subject: [PATCH 1/3] Fix SM8250 boot FAT cluster size --- board/qualcomm/sm8250/genimage.cfg | 2 +- board/qualcomm/sm8250/rp5/genimage.cfg | 2 +- board/qualcomm/sm8250/rpflip2/genimage.cfg | 2 +- board/qualcomm/sm8250/rpmini/genimage.cfg | 2 +- board/qualcomm/sm8250/rpminiv2/genimage.cfg | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/board/qualcomm/sm8250/genimage.cfg b/board/qualcomm/sm8250/genimage.cfg index f4162313..f35387cc 100644 --- a/board/qualcomm/sm8250/genimage.cfg +++ b/board/qualcomm/sm8250/genimage.cfg @@ -1,6 +1,6 @@ image boot.vfat { vfat { - extraargs = "-F 32 -n KNULLI" + extraargs = "-F 32 -s 32 -n KNULLI" @files } diff --git a/board/qualcomm/sm8250/rp5/genimage.cfg b/board/qualcomm/sm8250/rp5/genimage.cfg index f4162313..f35387cc 100644 --- a/board/qualcomm/sm8250/rp5/genimage.cfg +++ b/board/qualcomm/sm8250/rp5/genimage.cfg @@ -1,6 +1,6 @@ image boot.vfat { vfat { - extraargs = "-F 32 -n KNULLI" + extraargs = "-F 32 -s 32 -n KNULLI" @files } diff --git a/board/qualcomm/sm8250/rpflip2/genimage.cfg b/board/qualcomm/sm8250/rpflip2/genimage.cfg index f4162313..f35387cc 100644 --- a/board/qualcomm/sm8250/rpflip2/genimage.cfg +++ b/board/qualcomm/sm8250/rpflip2/genimage.cfg @@ -1,6 +1,6 @@ image boot.vfat { vfat { - extraargs = "-F 32 -n KNULLI" + extraargs = "-F 32 -s 32 -n KNULLI" @files } diff --git a/board/qualcomm/sm8250/rpmini/genimage.cfg b/board/qualcomm/sm8250/rpmini/genimage.cfg index f4162313..f35387cc 100644 --- a/board/qualcomm/sm8250/rpmini/genimage.cfg +++ b/board/qualcomm/sm8250/rpmini/genimage.cfg @@ -1,6 +1,6 @@ image boot.vfat { vfat { - extraargs = "-F 32 -n KNULLI" + extraargs = "-F 32 -s 32 -n KNULLI" @files } diff --git a/board/qualcomm/sm8250/rpminiv2/genimage.cfg b/board/qualcomm/sm8250/rpminiv2/genimage.cfg index f4162313..f35387cc 100644 --- a/board/qualcomm/sm8250/rpminiv2/genimage.cfg +++ b/board/qualcomm/sm8250/rpminiv2/genimage.cfg @@ -1,6 +1,6 @@ image boot.vfat { vfat { - extraargs = "-F 32 -n KNULLI" + extraargs = "-F 32 -s 32 -n KNULLI" @files } From 8d1cf37e2f8bbb8047da6b0335cfeab802035497 Mon Sep 17 00:00:00 2001 From: Updawg <10038272+updawg@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:42:29 -0400 Subject: [PATCH 2/3] Map SM8250 power key to GRUB enter --- .../grub2/001-map-suspend-key-to-enter.patch | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch diff --git a/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch b/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch new file mode 100644 index 00000000..d1feebc1 --- /dev/null +++ b/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch @@ -0,0 +1,28 @@ +--- a/grub-core/term/efi/console.c ++++ b/grub-core/term/efi/console.c +@@ -207,20 +207,25 @@ const unsigned efi_codes[] = ++#define GRUB_EFI_SCAN_SUSPEND 0x0102 ++ + static int + grub_efi_translate_key (grub_efi_input_key_t key) + { + if (key.scan_code == 0) + { + /* Some firmware implementations use VT100-style codes against the spec. + This is especially likely if driven by serial. + */ + if (key.unicode_char < 0x20 && key.unicode_char != 0 + && key.unicode_char != '\t' && key.unicode_char != '\b' + && key.unicode_char != '\n' && key.unicode_char != '\r') + return GRUB_TERM_CTRL | (key.unicode_char - 1 + 'a'); + else + return key.unicode_char; + } + /* Some devices send enter with scan_code 0x0d (F3) and unicode_char 0x0d. */ + else if (key.scan_code == '\r' && key.unicode_char == '\r') + return key.unicode_char; ++ /* Qualcomm firmware reports the power button as EFI_SCAN_SUSPEND. */ ++ else if (key.scan_code == GRUB_EFI_SCAN_SUSPEND) ++ return '\r'; + else if (key.scan_code < ARRAY_SIZE (efi_codes)) + return efi_codes[key.scan_code]; From 2eacf2ad551b33f40e2a25acd987a680a3e032e4 Mon Sep 17 00:00:00 2001 From: Updawg <10038272+updawg@users.noreply.github.com> Date: Tue, 28 Jul 2026 14:01:51 -0400 Subject: [PATCH 3/3] Clear queued SM8250 input before GRUB menu --- .../grub2/001-map-suspend-key-to-enter.patch | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch b/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch index d1feebc1..a28b3740 100644 --- a/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch +++ b/board/qualcomm/sm8250/patches/grub2/001-map-suspend-key-to-enter.patch @@ -1,23 +1,15 @@ --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c -@@ -207,20 +207,25 @@ const unsigned efi_codes[] = +@@ -204,6 +204,8 @@ + GRUB_TERM_KEY_F10, GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, GRUB_TERM_ESC + }; + +#define GRUB_EFI_SCAN_SUSPEND 0x0102 + static int grub_efi_translate_key (grub_efi_input_key_t key) { - if (key.scan_code == 0) - { - /* Some firmware implementations use VT100-style codes against the spec. - This is especially likely if driven by serial. - */ - if (key.unicode_char < 0x20 && key.unicode_char != 0 - && key.unicode_char != '\t' && key.unicode_char != '\b' - && key.unicode_char != '\n' && key.unicode_char != '\r') - return GRUB_TERM_CTRL | (key.unicode_char - 1 + 'a'); - else - return key.unicode_char; - } +@@ -222,6 +224,9 @@ /* Some devices send enter with scan_code 0x0d (F3) and unicode_char 0x0d. */ else if (key.scan_code == '\r' && key.unicode_char == '\r') return key.unicode_char; @@ -26,3 +18,17 @@ + return '\r'; else if (key.scan_code < ARRAY_SIZE (efi_codes)) return efi_codes[key.scan_code]; + +@@ -365,6 +370,12 @@ + text_input = grub_efi_open_protocol(grub_efi_system_table->console_in_handler, + &text_input_ex_guid, + GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); ++ ++ /* Discard keys queued by firmware before GRUB took over input. This is ++ particularly important when the power button is also used as Enter. */ ++ if (text_input) ++ text_input->reset (text_input, 0); ++ + term->data = (void *)text_input; + + return 0;