diff mbox series

external/mambo: 4 byte align chained CPIOs

Message ID 20201126020151.281350-1-mikey@neuling.org
State Accepted
Headers show
Series external/mambo: 4 byte align chained CPIOs | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (89a32b4930be829f37e6967354a759e38048d01f)

Commit Message

Michael Neuling Nov. 26, 2020, 2:01 a.m. UTC
Linux requires chained CPIOs to be 4 byte aligned otherwise they are
ignored. This aligns them.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 external/mambo/skiboot.tcl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dan Horák Nov. 27, 2020, 7:49 a.m. UTC | #1
On Thu, 26 Nov 2020 13:01:51 +1100
Michael Neuling <mikey@neuling.org> wrote:

> Linux requires chained CPIOs to be 4 byte aligned otherwise they are
> ignored. This aligns them.
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
>  external/mambo/skiboot.tcl | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

LGTM

Reviewed-by: Dan Horák <dan@danny.cz>


		Dan

> 
> diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
> index 76d29f6e9080..3a8e19406f29 100644
> --- a/external/mambo/skiboot.tcl
> +++ b/external/mambo/skiboot.tcl
> @@ -274,13 +274,14 @@ if { [info exists env(SKIBOOT_INITRD)] } {
>  	    set cpio_size [file size $cpio_file]
>  	    mysim mcm 0 memory fread $cpio_end $cpio_size $cpio_file
>  	    set cpio_end [expr $cpio_end + $cpio_size]
> +	    # Linux requires cpios are 4 byte aligned
> +	    set cpio_end [expr $cpio_end + 3 & 0xfffffffffffffffc]
>      }
>  
>      mysim of addprop $chosen_node int "linux,initrd-start" $cpio_start
>      mysim of addprop $chosen_node int "linux,initrd-end"   $cpio_end
>  }
>  
> -
>  # Map persistent memory disks
>  proc pmem_node_add { root start size } {
>      set start_hex [format %x $start]
> -- 
> 2.28.0
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Vasant Hegde Nov. 27, 2020, 11:57 a.m. UTC | #2
On 11/26/20 7:31 AM, Michael Neuling wrote:
> Linux requires chained CPIOs to be 4 byte aligned otherwise they are
> ignored. This aligns them.

Thanks! Merged as 3e2ad44e.

-Vasant
diff mbox series

Patch

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index 76d29f6e9080..3a8e19406f29 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -274,13 +274,14 @@  if { [info exists env(SKIBOOT_INITRD)] } {
 	    set cpio_size [file size $cpio_file]
 	    mysim mcm 0 memory fread $cpio_end $cpio_size $cpio_file
 	    set cpio_end [expr $cpio_end + $cpio_size]
+	    # Linux requires cpios are 4 byte aligned
+	    set cpio_end [expr $cpio_end + 3 & 0xfffffffffffffffc]
     }
 
     mysim of addprop $chosen_node int "linux,initrd-start" $cpio_start
     mysim of addprop $chosen_node int "linux,initrd-end"   $cpio_end
 }
 
-
 # Map persistent memory disks
 proc pmem_node_add { root start size } {
     set start_hex [format %x $start]