[PATCH] board: starqltechn: enable serial console

It was temporary disabled due to problem with boot. Issue was fixed in commit f5ed6c9ccf3e ("uart: sdm845: Fix debug UART pinmux")
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com --- configs/starqltechn_defconfig | 4 ++-- include/configs/sdm845.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig index 7955076d61..7a64f2a7a0 100644 --- a/configs/starqltechn_defconfig +++ b/configs/starqltechn_defconfig @@ -20,14 +20,14 @@ CONFIG_SYS_PBSIZE=532 CONFIG_CMD_GPIO=y CONFIG_CMD_BMP=y # CONFIG_NET is not set -# CONFIG_DM_STDIO is not set CONFIG_CLK=y CONFIG_MSM_GPIO=y CONFIG_QCOM_PMIC_GPIO=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_PMIC_QCOM=y -# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_REQUIRE_SERIAL_CONSOLE=y +CONFIG_MSM_GENI_SERIAL=y CONFIG_SPMI_MSM=y CONFIG_VIDEO=y CONFIG_SYS_WHITE_ON_BLACK=y diff --git a/include/configs/sdm845.h b/include/configs/sdm845.h index af5fe27e68..ec6cb3a13c 100644 --- a/include/configs/sdm845.h +++ b/include/configs/sdm845.h @@ -16,8 +16,9 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "bootm_size=0x4000000\0" \ "bootm_low=0x80000000\0" \ - "stdout=vidconsole\0" \ - "stderr=vidconsole\0" \ + "stdin=serial\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" \ "preboot=source $prevbl_initrd_start_addr:prebootscript\0" \ "bootcmd=source $prevbl_initrd_start_addr:bootscript\0"

KASLR address is needed to boot fully functional Android. KASLR is set by primary bootloader, and since u-boot is used as a secondary bootloader(replacing kernel) on sdm845 platform, KASLR may be found by comparing memory chunks at relocaddr over supposed KASLR range.
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com --- arch/arm/mach-snapdragon/init_sdm845.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-snapdragon/init_sdm845.c b/arch/arm/mach-snapdragon/init_sdm845.c index 5f53c21947..1f88502394 100644 --- a/arch/arm/mach-snapdragon/init_sdm845.c +++ b/arch/arm/mach-snapdragon/init_sdm845.c @@ -78,5 +78,23 @@ __weak int misc_init_r(void) env_set("key_power", "0"); }
+ /* + * search for kaslr address, set by primary bootloader by searching first + * 0x100 relocated bytes at u-boot's initial load address range + */ + uintptr_t start = gd->ram_base; + uintptr_t end = start + 0x800000; + u8 *addr = (u8 *)start; + phys_addr_t *relocaddr = (phys_addr_t *)gd->relocaddr; + u32 block_size = 0x1000; + + while (memcmp(addr, relocaddr, 0x100) && (uintptr_t)addr < end) + addr += block_size; + + if ((uintptr_t)addr >= end) + printf("KASLR not found in range 0x%lx - 0x%lx", start, end); + else + env_set_addr("KASLR", addr); + return 0; }

On Tue, Dec 27, 2022 at 9:47 PM Dzmitry Sankouski dsankouski@gmail.com wrote:
KASLR address is needed to boot fully functional Android. KASLR is set by primary bootloader, and since u-boot is used as a secondary bootloader(replacing kernel) on sdm845 platform, KASLR may be found by comparing memory chunks at relocaddr over supposed KASLR range.
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com
arch/arm/mach-snapdragon/init_sdm845.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-snapdragon/init_sdm845.c b/arch/arm/mach-snapdragon/init_sdm845.c index 5f53c21947..1f88502394 100644 --- a/arch/arm/mach-snapdragon/init_sdm845.c +++ b/arch/arm/mach-snapdragon/init_sdm845.c @@ -78,5 +78,23 @@ __weak int misc_init_r(void) env_set("key_power", "0"); }
/*
* search for kaslr address, set by primary bootloader by searching first
* 0x100 relocated bytes at u-boot's initial load address range
*/
uintptr_t start = gd->ram_base;
uintptr_t end = start + 0x800000;
u8 *addr = (u8 *)start;
phys_addr_t *relocaddr = (phys_addr_t *)gd->relocaddr;
u32 block_size = 0x1000;
while (memcmp(addr, relocaddr, 0x100) && (uintptr_t)addr < end)
addr += block_size;
if ((uintptr_t)addr >= end)
printf("KASLR not found in range 0x%lx - 0x%lx", start, end);
else
env_set_addr("KASLR", addr);
return 0;
}
2.30.2
Reviewed-by: Ramon Fried rfried.dev@gmail.com

On Tue, Dec 27, 2022 at 10:47:09PM +0300, Dzmitry Sankouski wrote:
KASLR address is needed to boot fully functional Android. KASLR is set by primary bootloader, and since u-boot is used as a secondary bootloader(replacing kernel) on sdm845 platform, KASLR may be found by comparing memory chunks at relocaddr over supposed KASLR range.
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com Reviewed-by: Ramon Fried rfried.dev@gmail.com
Applied to u-boot/master, thanks!

On Tue, Dec 27, 2022 at 7:47 PM Dzmitry Sankouski dsankouski@gmail.com wrote:
KASLR address is needed to boot fully functional Android. KASLR is set by primary bootloader, and since u-boot is used as a secondary bootloader(replacing kernel) on sdm845 platform, KASLR may be found by comparing memory chunks at relocaddr over supposed KASLR range.
By KASLR I presume you mean the random seed? KASLR is a technology used in the kernel, but it's actually a random seed that's passed to the kernel to generate the random layout.
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com
arch/arm/mach-snapdragon/init_sdm845.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-snapdragon/init_sdm845.c b/arch/arm/mach-snapdragon/init_sdm845.c index 5f53c21947..1f88502394 100644 --- a/arch/arm/mach-snapdragon/init_sdm845.c +++ b/arch/arm/mach-snapdragon/init_sdm845.c @@ -78,5 +78,23 @@ __weak int misc_init_r(void) env_set("key_power", "0"); }
/*
* search for kaslr address, set by primary bootloader by searching first
* 0x100 relocated bytes at u-boot's initial load address range
*/
uintptr_t start = gd->ram_base;
uintptr_t end = start + 0x800000;
u8 *addr = (u8 *)start;
phys_addr_t *relocaddr = (phys_addr_t *)gd->relocaddr;
u32 block_size = 0x1000;
while (memcmp(addr, relocaddr, 0x100) && (uintptr_t)addr < end)
addr += block_size;
if ((uintptr_t)addr >= end)
printf("KASLR not found in range 0x%lx - 0x%lx", start, end);
else
env_set_addr("KASLR", addr);
return 0;
}
2.30.2

Right.
ср, 11 янв. 2023 г. в 05:36, Peter Robinson pbrobinson@gmail.com:
On Tue, Dec 27, 2022 at 7:47 PM Dzmitry Sankouski dsankouski@gmail.com wrote:
KASLR address is needed to boot fully functional Android. KASLR is set by primary bootloader, and since u-boot is used as a secondary bootloader(replacing kernel) on sdm845 platform, KASLR may be found by comparing memory chunks at relocaddr over supposed KASLR range.
By KASLR I presume you mean the random seed? KASLR is a technology used in the kernel, but it's actually a random seed that's passed to the kernel to generate the random layout.
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com
arch/arm/mach-snapdragon/init_sdm845.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-snapdragon/init_sdm845.c b/arch/arm/mach-snapdragon/init_sdm845.c index 5f53c21947..1f88502394 100644 --- a/arch/arm/mach-snapdragon/init_sdm845.c +++ b/arch/arm/mach-snapdragon/init_sdm845.c @@ -78,5 +78,23 @@ __weak int misc_init_r(void) env_set("key_power", "0"); }
/*
* search for kaslr address, set by primary bootloader by searching first
* 0x100 relocated bytes at u-boot's initial load address range
*/
uintptr_t start = gd->ram_base;
uintptr_t end = start + 0x800000;
u8 *addr = (u8 *)start;
phys_addr_t *relocaddr = (phys_addr_t *)gd->relocaddr;
u32 block_size = 0x1000;
while (memcmp(addr, relocaddr, 0x100) && (uintptr_t)addr < end)
addr += block_size;
if ((uintptr_t)addr >= end)
printf("KASLR not found in range 0x%lx - 0x%lx", start, end);
else
env_set_addr("KASLR", addr);
return 0;
}
2.30.2

On Tue, Dec 27, 2022 at 10:47:08PM +0300, Dzmitry Sankouski wrote:
It was temporary disabled due to problem with boot. Issue was fixed in commit f5ed6c9ccf3e ("uart: sdm845: Fix debug UART pinmux")
Signed-off-by: Dzmitry Sankouski dsankouski@gmail.com
Applied to u-boot/master, thanks!
participants (4)
-
Dzmitry Sankouski
-
Peter Robinson
-
Ramon Fried
-
Tom Rini