On 2017-01-10 19:08, Ralf Ramsauer wrote:
> On 01/10/2017 06:28 PM, Jan Kiszka wrote:
>> On 2017-01-10 18:05, Ralf Ramsauer wrote:
>>> Hi,
>>>
>>> I'm experiencing some issues with Linux inmates on ARM on my Jetson TK1
>>> since inmate kernel 4.9.
>>>
>>> While the same .config works fine with 4.8, since 4.9 I get the
>>> following error message:
>>>
>>> [    0.311186] Unpacking initramfs...
>>> [    0.311211] Initramfs unpacking failed: junk in compressed archive
>>>
>>> and of course, a few messages later this is followed by an 'unable to
>>> mount rootfs'.
>>>
>>> Now, the point is that my initramfs is actually an uncompressed one (I'm
>>> using buildroot for generating it). There is no point in compressing it.
>>
>> Mine are uncompressed as well, hmm...
>>
>>>
>>> But even if I'm gzipping it before: I still get the same error message
>>> (while 4.8 is able to successfully boot the compressed archive).
>>> Recompressing it with cpio doesn't solve the issue as well, so I doubt
>>> that my archive is broken...
>>>
>>> The code producing this error message (in init/initramfs.c) wasn't
>>> touched since 09/15, so this must be something else...
>>>
>>> Anyone any suggestions?
>>
>> Kernel too big? Try playing with our magic formula:
> Nope, kernel is not really too big:
> 3.3M zImage-inmate-4.8 (working one)
> 3.4M zImage-inmate-4.9
> so it just got ~100KB larger.

That's compressed. You need to look at the uncompressed Image to tell
the real difference.

>>
>>             # leave sufficient space between the kernel and the initrd
>>             image_size += kernel_size * 4
>>
>> (this sucks...)
> Thanks, and in deed some magic happened! This did the trick:
> 
> diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux
> index 790f474..0d195a3 100755
> --- a/tools/jailhouse-cell-linux
> +++ b/tools/jailhouse-cell-linux
> @@ -310,7 +310,7 @@ class ARMCommon:
>              ramdisk_size =
> page_align(os.fstat(args.initrd.fileno()).st_size)
>              # leave sufficient space between the kernel and the initrd
>              image_size += kernel_size * 4
> -            kernel_size *= 5
> +            kernel_size *= 6
> 
>          if not args.dtb:
>              print('No device tree specified', file=sys.stderr)
> 
> 
> Though I don't really understand why it now works and what I actually
> changed. :-)
> 
> Params before:
> [...] /root/zImage-inmate-4.9 -a 0xe8002000 /root/rootfs.cpio -a
> 0xe908d000 /dev/null -a 0xe8000000
> 
> Params after:
> [...] /root/zImage-inmate-4.9 -a 0xe8002000 /root/rootfs.cpio -a
> 0xe93dc000 /dev/null -a 0xe8000000
> 
> Seems that there is now more (free) space between the kernel and the initrd.

The kernel is apparently unpacked right after the packed image (plus
some alignment). If the unpacked image gets too large and overwrites the
initrd - outch...

We should probably move the initrd at the end of the memory region, on
all archs. That would also move the responsibility for the gap to the
user ;).

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to