Hi Heinrich,

On Sat, Feb 22, 2025 at 10:55 AM Heinrich Schuchardt <xypron.g...@gmx.de> wrote:
>
> Am 21. Februar 2025 13:58:53 MEZ schrieb Mayuresh Chitale 
> <mchit...@ventanamicro.com>:
> >For bootm, disallow booting an image that was built for an arch type
> >other than the current arch. For booti, set the arch type same as the
> >current arch.
>
> Hello Mayuresh,
>
> The code change looks fine, but the commit message could be a bit more 
> exhaustive:
>
> A commit message should provide the reason why you are making a change. E.g. 
> you could state that booting a RISC-V FIT image of different bitness is not 
> supported by the current code and that you want to catch that problem early.
>
> The current commit message sounds like you are forbidding booting amd64 from 
> i386, too. Please, mention that this is a RISC-V only change in the commit 
> message.

Sure. Will do that.
>
> Best regards
>
> Heinrich
>
> >
> >Signed-off-by: Mayuresh Chitale <mchit...@ventanamicro.com>
> >---
> > arch/riscv/lib/bootm.c | 4 ++++
> > cmd/booti.c            | 5 ++++-
> > 2 files changed, 8 insertions(+), 1 deletion(-)
> >
> >diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
> >index 76c610bcee0..90f71bee6a5 100644
> >--- a/arch/riscv/lib/bootm.c
> >+++ b/arch/riscv/lib/bootm.c
> >@@ -94,6 +94,10 @@ static void boot_jump_linux(struct bootm_headers *images, 
> >int flag)
> >       announce_and_cleanup(fake);
> >
> >       if (!fake) {
> >+              if (images->os.arch != IH_ARCH_DEFAULT) {
> >+                      printf("Image arch not compatible with host arch.\n");
> >+                      hang();
> >+              }
> >               if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) {
> > #ifdef CONFIG_SMP
> >                       ret = smp_call_function(images->ep,
> >diff --git a/cmd/booti.c b/cmd/booti.c
> >index 1a57fe91397..00921ec4a9d 100644
> >--- a/cmd/booti.c
> >+++ b/cmd/booti.c
> >@@ -131,7 +131,10 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, 
> >char *const argv[])
> >
> >       images.os.os = IH_OS_LINUX;
> >       if (IS_ENABLED(CONFIG_RISCV_SMODE))
> >-              images.os.arch = IH_ARCH_RISCV;
> >+              if (IS_ENABLED(CONFIG_64BIT))
> >+                      images.os.arch = IH_ARCH_RISCV64;
> >+              else
> >+                      images.os.arch = IH_ARCH_RISCV;
> >       else if (IS_ENABLED(CONFIG_ARM64))
> >               images.os.arch = IH_ARCH_ARM64;
> >
>

Reply via email to