Skip to content

Commit 69871f2

Browse files
committed
Re-work bootimg cmdline hooks and remove FLO_CMDLINE_HACK
1 parent efdb6c5 commit 69871f2

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

device_defines.mk

-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ ifeq ($(TARGET_DEVICE),grouper)
99
LOCAL_CFLAGS += -DMR_MOVE_USB_DIR
1010
endif
1111

12-
# Flo's bootloader removes first 26 characters from boot.img's cmdline
13-
# because of reasons. On unmodified boot.img, those 26 characters are
14-
# "console=ttyHSL0,115200,n8 "
15-
ifeq ($(TARGET_DEVICE),flo)
16-
LOCAL_CFLAGS += -DFLO_CMDLINE_HACK
17-
endif
18-
1912
ifeq ($(DEVICE_RESOLUTION),)
2013
$(info DEVICE_RESOLUTION was not specified)
2114
# FIXME

hooks.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int mrom_hook_allow_incomplete_fstab(void);
3737
#endif
3838

3939
#if MR_DEVICE_HOOKS >= 5
40-
int mrom_hook_cmdline_remove_bootimg_part(char *bootimg_cmdline, size_t bootimg_cmdline_cap, char *complete_cmdline, size_t complete_cmdline_cap);
40+
void mrom_hook_fixup_bootimg_cmdline(char *bootimg_cmdline, size_t bootimg_cmdline_cap);
4141
#endif
4242

4343
#endif /* MR_DEVICE_HOOKS */

multirom.c

+11-19
Original file line numberDiff line numberDiff line change
@@ -1555,24 +1555,16 @@ int multirom_get_bootloader_cmdline(struct multirom_status *s, char *str, size_t
15551555
l = (char*)hdr.cmdline;
15561556
hdr.cmdline[BOOT_ARGS_SIZE-1] = 0;
15571557

1558-
#ifdef FLO_CMDLINE_HACK
1559-
// Flo's bootloader (at least 03.15) removes first 26 characters
1560-
// from boot.img's cmdline because of reasons. On stock
1561-
// boot.img, those 26 characters are "console=ttyHSL0,115200,n8 "
1562-
l += 26;
1563-
#endif
1564-
15651558
#if MR_DEVICE_HOOKS >= 5
1566-
if(mrom_hook_cmdline_remove_bootimg_part(l, BOOT_ARGS_SIZE, str, size) != 1)
1559+
mrom_hook_fixup_bootimg_cmdline(l, BOOT_ARGS_SIZE);
15671560
#endif
1561+
1562+
if(*l != 0 && (c = strstr(str, l)))
15681563
{
1569-
if(*l != 0 && (c = strstr(str, l)))
1570-
{
1571-
e = c + strlen(l);
1572-
if(*e == ' ')
1573-
++e;
1574-
memmove(c, e, strlen(e)+1); // plus NULL
1575-
}
1564+
e = c + strlen(l);
1565+
if(*e == ' ')
1566+
++e;
1567+
memmove(c, e, strlen(e)+1); // plus NULL
15761568
}
15771569
}
15781570

@@ -1717,11 +1709,11 @@ int multirom_fill_kexec_android(struct multirom_status *s, struct multirom_rom *
17171709
img.hdr.cmdline[BOOT_ARGS_SIZE-1] = 0;
17181710

17191711
// see multirom_get_bootloader_cmdline
1720-
#ifdef FLO_CMDLINE_HACK
1721-
strcat(cmdline, (char*)img.hdr.cmdline+26);
1722-
#else
1723-
strcat(cmdline, (char*)img.hdr.cmdline);
1712+
#if MR_DEVICE_HOOKS >= 5
1713+
mrom_hook_fixup_bootimg_cmdline((char*)img.hdr.cmdline, BOOT_ARGS_SIZE);
17241714
#endif
1715+
1716+
strcat(cmdline, (char*)img.hdr.cmdline);
17251717
strcat(cmdline, " ");
17261718
}
17271719

0 commit comments

Comments
 (0)