[Galaxy S III I9305 (4G LTE + 2GB RAM) Android Deve] .NetRolller 3D:
I'm experiencing an issue (not specific to this kernel) where my I9305 runs out of vmalloc space due to the old bootloader passing "vmalloc=144m" (new one would do "vmalloc=176m", but I would rather not install it - besides, it's just 32M extra, so just as likely to fill up), resulting in a never-ending stream of FCs. Would it be possible to make a kernel that overrides the vmalloc parameter in a similar way?

EDIT: The I9300 (with just 1GB RAM) also uses vmalloc=144m, so it's obviously undersized; other 2GB RAM devices tend to have vmalloc spaces around 400M (there is even a kernel for the S5 that bumps vmalloc to 512M from the original 400M). I would say let's get brave and replace vmalloc=144m (or vmalloc=176m if present) with vmalloc=400m (512m is probably an overkill for a 720p device).

EDIT 2: Here is a modded AGNi kernel with that fix (as well as the LPM fix): https://mega.co.nz/#!zYp0XS7D!6ZimeSRCnczqArRBtZwAdqHT01Y832ZtPfaopSHDfuA

BUG in this kernel: phone locks up trying to play video. I'm investigating it. Fixed version uploaded.

This is just AGNi I9305-4.4.4 compiled from Github using Linaro 2015-03, with this patch:

[PATCH] Implement scholbert's offline charging fix and add vmalloc fix

Signed-off-by: Gábor Stefanik <netrolller.3d@...>
---
arch/arm/Kconfig | 12 ++++++++++
arch/arm/configs/psn_i9305_new_defconfig | 1 +
arch/arm/configs/psn_i9305_new_wolf_defconfig | 1 +
arch/arm/kernel/setup.c | 29 +++++++++++++++++++++++++
4 files changed, 43 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1dc4875..e0c2854 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1901,6 +1901,18 @@ config CMDLINE_FORCE
command-line options your boot loader passes to the kernel.
endchoice

+config CMDLINE_FIXUP
+bool "Correct broken Samsung bootloader kernel arguments"
+depends on CMDLINE_FROM_BOOTLOADER || CMDLINE_EXTEND
+help
+ Some Samsung smartphone bootloaders send invalid kernel command
+ strings. This can cause failure to detect that the device is in
+ charging mode, or insufficient vmalloc space; leading to OOM
+ errors and potentially preventing boot.
+
+ Say Y here if you have a broken bootloader and experience any of
+ these symptoms.
+
config XIP_KERNEL
bool "Kernel Execute-In-Place from ROM"
depends on !ZBOOT_ROM
diff --git a/arch/arm/configs/psn_i9305_new_defconfig b/arch/arm/configs/psn_i9305_new_defconfig
index 2a6c88a..6036bf2 100644
--- a/arch/arm/configs/psn_i9305_new_defconfig
+++ b/arch/arm/configs/psn_i9305_new_defconfig
@@ -784,6 +784,7 @@ CONFIG_CMDLINE="console=ttySAC2,115200"
CONFIG_CMDLINE_FROM_BOOTLOADER=y
# CONFIG_CMDLINE_EXTEND is not set
# CONFIG_CMDLINE_FORCE is not set
+CONFIG_CMDLINE_FIXUP=y
# CONFIG_XIP_KERNEL is not set
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y
diff --git a/arch/arm/configs/psn_i9305_new_wolf_defconfig b/arch/arm/configs/psn_i9305_new_wolf_defconfig
index 05d5cb8..2f1dada 100644
--- a/arch/arm/configs/psn_i9305_new_wolf_defconfig
+++ b/arch/arm/configs/psn_i9305_new_wolf_defconfig
@@ -784,6 +784,7 @@ CONFIG_CMDLINE="console=ttySAC2,115200"
CONFIG_CMDLINE_FROM_BOOTLOADER=y
# CONFIG_CMDLINE_EXTEND is not set
# CONFIG_CMDLINE_FORCE is not set
+CONFIG_CMDLINE_FIXUP=y
# CONFIG_XIP_KERNEL is not set
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a9ead89..111b78b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -671,6 +671,9 @@ __tagtable(ATAG_REVISION, parse_tag_revision);

static int __init parse_tag_cmdline(const struct tag *tag)
{
+#if defined(CONFIG_CMDLINE_FIXUP)
+size_t cmdline_len = strlen(default_command_line);
+#endif
#if defined(CONFIG_CMDLINE_EXTEND)
strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
strlcat(default_command_line, tag->u.cmdline.cmdline,
@@ -680,6 +683,32 @@ static int __init parse_tag_cmdline(const struct tag *tag)
#else
strlcpy(default_command_line, tag->u.cmdline.cmdline,
COMMAND_LINE_SIZE);
+#if defined(CONFIG_CMDLINE_FIXUP)
+cmdline_len = 0;
+#endif
+#endif
+#if defined(CONFIG_CMDLINE_FIXUP)
+/*
+ * check for the proprietary parameter "lpcharge=1 and add the corresponding
+ * standard parameter "androidboot.mode=charger"
+ */
+if (strstr(default_command_line + cmdline_len, "lpcharge=1")) {
+strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
+strlcat(default_command_line, "androidboot.mode=charger",
+COMMAND_LINE_SIZE);
+}
+
+/* increase vmalloc space from 144m or 176m to 224m */
+char *vma_param = strstr(default_command_line + cmdline_len, "vmalloc=144m");
+if (!vma_param) {
+vma_param = strstr(default_command_line + cmdline_len, "vmalloc=176m");
+}
+
+if (vma_param) {
+vma_param[8] = '2';
+vma_param[9] = '2';
+vma_param[10] = '4';
+}
#endif
return 0;
}

Full source available @ https://github.com/gstefanik/AGNI-pureSTOCK