All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: starqltechn: enable serial console
@ 2022-12-27 19:47 Dzmitry Sankouski
  2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
  2023-01-11  2:17 ` [PATCH] board: starqltechn: enable serial console Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Dzmitry Sankouski @ 2022-12-27 19:47 UTC (permalink / raw)
  To: u-boot; +Cc: Dzmitry Sankouski, Peng Fan

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"
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] SoC: sdm845: find and save KASLR to env variables
  2022-12-27 19:47 [PATCH] board: starqltechn: enable serial console Dzmitry Sankouski
@ 2022-12-27 19:47 ` Dzmitry Sankouski
  2023-01-10 17:14   ` Ramon Fried
                     ` (2 more replies)
  2023-01-11  2:17 ` [PATCH] board: starqltechn: enable serial console Tom Rini
  1 sibling, 3 replies; 7+ messages in thread
From: Dzmitry Sankouski @ 2022-12-27 19:47 UTC (permalink / raw)
  To: u-boot; +Cc: Dzmitry Sankouski, Ramon Fried

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] SoC: sdm845: find and save KASLR to env variables
  2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
@ 2023-01-10 17:14   ` Ramon Fried
  2023-01-11  2:17   ` Tom Rini
  2023-01-11  2:36   ` Peter Robinson
  2 siblings, 0 replies; 7+ messages in thread
From: Ramon Fried @ 2023-01-10 17:14 UTC (permalink / raw)
  To: Dzmitry Sankouski; +Cc: u-boot

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>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] board: starqltechn: enable serial console
  2022-12-27 19:47 [PATCH] board: starqltechn: enable serial console Dzmitry Sankouski
  2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
@ 2023-01-11  2:17 ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-01-11  2:17 UTC (permalink / raw)
  To: Dzmitry Sankouski; +Cc: u-boot, Peng Fan

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

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!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SoC: sdm845: find and save KASLR to env variables
  2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
  2023-01-10 17:14   ` Ramon Fried
@ 2023-01-11  2:17   ` Tom Rini
  2023-01-11  2:36   ` Peter Robinson
  2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2023-01-11  2:17 UTC (permalink / raw)
  To: Dzmitry Sankouski; +Cc: u-boot, Ramon Fried

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

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!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SoC: sdm845: find and save KASLR to env variables
  2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
  2023-01-10 17:14   ` Ramon Fried
  2023-01-11  2:17   ` Tom Rini
@ 2023-01-11  2:36   ` Peter Robinson
  2023-01-11 12:15     ` Dzmitry Sankouski
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Robinson @ 2023-01-11  2:36 UTC (permalink / raw)
  To: Dzmitry Sankouski; +Cc: u-boot, Ramon Fried

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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] SoC: sdm845: find and save KASLR to env variables
  2023-01-11  2:36   ` Peter Robinson
@ 2023-01-11 12:15     ` Dzmitry Sankouski
  0 siblings, 0 replies; 7+ messages in thread
From: Dzmitry Sankouski @ 2023-01-11 12:15 UTC (permalink / raw)
  To: Peter Robinson; +Cc: u-boot, Ramon Fried

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
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-11 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27 19:47 [PATCH] board: starqltechn: enable serial console Dzmitry Sankouski
2022-12-27 19:47 ` [PATCH] SoC: sdm845: find and save KASLR to env variables Dzmitry Sankouski
2023-01-10 17:14   ` Ramon Fried
2023-01-11  2:17   ` Tom Rini
2023-01-11  2:36   ` Peter Robinson
2023-01-11 12:15     ` Dzmitry Sankouski
2023-01-11  2:17 ` [PATCH] board: starqltechn: enable serial console Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.