summaryrefslogtreecommitdiff
path: root/bootloader/x1000/x1000bootloader.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-16 22:22:01 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-24 23:40:07 +0000
commitf7a341555d1addb49a8b7084977ce7b44b4aa019 (patch)
treee95ce7bfeff2841eb734a7215cfdd6734ad73134 /bootloader/x1000/x1000bootloader.h
parent6a6c6083fa69575334282d0c8f5dd688a2282188 (diff)
downloadrockbox-f7a341555d1addb49a8b7084977ce7b44b4aa019.tar.gz
rockbox-f7a341555d1addb49a8b7084977ce7b44b4aa019.zip
fiiom3k: trim OF kernel arguments to fix boot hangs
The M3K's kernel has an incredibly stupid function that mangles the kernel args and copies them to a 100-byte buffer without any kind of bounds checking. So, if the kernel arguments are more than 99 chars the stack may be corrupted, sometimes crashing the kernel. Fortunately, most of the arguments the OF uses are useless, and the truly necessary arguments fit within the absurd 99-char limit. Change-Id: I01ef4513298f79d3c08538239802c21e88509631
Diffstat (limited to 'bootloader/x1000/x1000bootloader.h')
-rw-r--r--bootloader/x1000/x1000bootloader.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/bootloader/x1000/x1000bootloader.h b/bootloader/x1000/x1000bootloader.h
index 10f6c6e730..b0d8d378f4 100644
--- a/bootloader/x1000/x1000bootloader.h
+++ b/bootloader/x1000/x1000bootloader.h
@@ -44,13 +44,19 @@ struct uimage_header;
44# define OF_PLAYER_NAME "FiiO player" 44# define OF_PLAYER_NAME "FiiO player"
45# define OF_PLAYER_ADDR 0x20000 45# define OF_PLAYER_ADDR 0x20000
46# define OF_PLAYER_LENGTH (4 * 1024 * 1024) 46# define OF_PLAYER_LENGTH (4 * 1024 * 1024)
47/* WARNING: The length of kernel arguments cannot exceed 99 bytes on the M3K
48 * due to an Ingenic kernel bug: plat_mem_setup() calls ddr_param_change() and
49 * that function tries to copy the command line to an 100-char buffer without
50 * any bounds checking. Overflowing the buffer typically leads to disaster.
51 * It seems ddr_param_change() is not present on all Ingenic kernels and the
52 * bug may not affect the Q1. */
47# define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ 53# define OF_PLAYER_ARGS OF_RECOVERY_ARGS \
48 " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw loglevel=8" 54 " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw"
49# define OF_RECOVERY_NAME "FiiO recovery" 55# define OF_RECOVERY_NAME "FiiO recovery"
50# define OF_RECOVERY_ADDR 0x420000 56# define OF_RECOVERY_ADDR 0x420000
51# define OF_RECOVERY_LENGTH (5 * 1024 * 1024) 57# define OF_RECOVERY_LENGTH (5 * 1024 * 1024)
52# define OF_RECOVERY_ARGS \ 58# define OF_RECOVERY_ARGS \
53 "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off" 59 "mem=64M console=ttyS2"
54#elif defined(SHANLING_Q1) 60#elif defined(SHANLING_Q1)
55# define BL_RECOVERY BUTTON_NEXT 61# define BL_RECOVERY BUTTON_NEXT
56# define BL_UP BUTTON_PREV 62# define BL_UP BUTTON_PREV