All of lore.kernel.org
 help / color / mirror / Atom feed
* struggling with initramfs
@ 2018-07-03 18:02 Tim Hammer
  2018-07-03 22:00 ` Prakash Ks
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Tim Hammer @ 2018-07-03 18:02 UTC (permalink / raw)
  To: yocto

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

Can anyone point me to a step-by-step tutorial or simple how-to on creating
and using an initramfs with my kernel for ARM aarch64?


I have tried creating my own:
 - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
 - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
 - linux.bbappend has INITRAMFS_IMAGE = "boot-image"

This all seems to be "correct" to the extent that bitbake linux tries to do
the right thing.

However, I get a failure in do_bundle_initramfs- "mv: cannot stat
'arch/arm64/boot/Image': No such file or directory".

To the best of my (limited) debugging abilities with Yocto, it seems like
the kernel image backup has already been run when it gets to this point and
the Image file in that directory has already been moved to Image.bak. If I
comment out the mv statement in kernel.bbclass causing the failure, the
process continues, but the initramfs does not seem to get populated or
perhaps installed into my kernel image as I get kernel panics that I have
been unable to get past.


I decided to take a different approach and try using the
core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
can even seem to boot into this initramfs- it counts down waiting for
removable media; seems to find my primary rootfs on sda3, but there is no
rootfs.img file there so says it is dropping to a shell (although I never
get a prompt...).

Thinking I could start with that recipe and work to get rid of the live
stuff and just get to a busybox prompt before trying to run my unique init
commands, I copied  core-image-minimal-initramfs.bb to my-
core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE to
"my- core-image-minimal-initramfs".
However, I obviously missed something in the configuration as I get an
error in go_bundle_initramfs again:
     kernel-source/scripts/gen_initramfs_list.sh:
                 Cannot open
'/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'

Any help would be greatly appreciated.
Thank you!
-- 

.Tim

[-- Attachment #2: Type: text/html, Size: 5250 bytes --]

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

* Re: struggling with initramfs
  2018-07-03 18:02 struggling with initramfs Tim Hammer
@ 2018-07-03 22:00 ` Prakash Ks
  2018-07-03 23:33 ` Andre McCurdy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Prakash Ks @ 2018-07-03 22:00 UTC (permalink / raw)
  To: tdhammer99; +Cc: yocto

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

Try Adding
KERNEL_INITRAMFS = "-initramfs"
in platform specific .conf file


Thanks!
Prakash

On Tue, Jul 3, 2018 at 11:53 AM Tim Hammer <tdhammer99@gmail.com> wrote:

>
> Can anyone point me to a step-by-step tutorial or simple how-to on
> creating and using an initramfs with my kernel for ARM aarch64?
>
>
> I have tried creating my own:
>  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
>  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"
>
> This all seems to be "correct" to the extent that bitbake linux tries to
> do the right thing.
>
> However, I get a failure in do_bundle_initramfs- "mv: cannot stat
> 'arch/arm64/boot/Image': No such file or directory".
>
> To the best of my (limited) debugging abilities with Yocto, it seems like
> the kernel image backup has already been run when it gets to this point and
> the Image file in that directory has already been moved to Image.bak. If I
> comment out the mv statement in kernel.bbclass causing the failure, the
> process continues, but the initramfs does not seem to get populated or
> perhaps installed into my kernel image as I get kernel panics that I have
> been unable to get past.
>
>
> I decided to take a different approach and try using the
> core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
> the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
> can even seem to boot into this initramfs- it counts down waiting for
> removable media; seems to find my primary rootfs on sda3, but there is no
> rootfs.img file there so says it is dropping to a shell (although I never
> get a prompt...).
>
> Thinking I could start with that recipe and work to get rid of the live
> stuff and just get to a busybox prompt before trying to run my unique init
> commands, I copied  core-image-minimal-initramfs.bb to my-
> core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE
> to "my- core-image-minimal-initramfs".
> However, I obviously missed something in the configuration as I get an
> error in go_bundle_initramfs again:
>      kernel-source/scripts/gen_initramfs_list.sh:
>                  Cannot open
> '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
>
> Any help would be greatly appreciated.
> Thank you!
> --
>
> .Tim
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>


-- 
Thanks and Regards,
Prakash K S
+91 9620140303

[-- Attachment #2: Type: text/html, Size: 6316 bytes --]

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

* Re: struggling with initramfs
  2018-07-03 18:02 struggling with initramfs Tim Hammer
  2018-07-03 22:00 ` Prakash Ks
@ 2018-07-03 23:33 ` Andre McCurdy
  2018-07-04 18:57 ` Ferry Toth
  2018-07-07 19:02 ` Ferry Toth
  3 siblings, 0 replies; 8+ messages in thread
From: Andre McCurdy @ 2018-07-03 23:33 UTC (permalink / raw)
  To: Tim Hammer; +Cc: Yocto discussion list

On Tue, Jul 3, 2018 at 11:02 AM, Tim Hammer <tdhammer99@gmail.com> wrote:
>
> Can anyone point me to a step-by-step tutorial or simple how-to on creating
> and using an initramfs with my kernel for ARM aarch64?
>
> I have tried creating my own:
>  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".

Note that the approach taken by kernel.bbclass is that the cpio image
is included uncompressed in the kernel and then (if you build a
compressed kernel image type) the kernel and cpio are compressed
together. What you've done is OK, but just be aware that
copy_initramfs() will uncompress the cpio image for you before it's
included in the kernel.

(If you want a compressed cpio image inside an uncompressed kernel
then kernel.bbclass would need some patching).

>  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"

Is your kernel recipe called linux? If not then the .bbappend might
not be applied when your actual kernel recipe is built. It doesn't
look like that's your issue as the error below from
do_bundle_initramfs() suggests that you got past the check that both
INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE are as expected, but In
general it's probably safest to keep INITRAMFS_IMAGE_BUNDLE and
INITRAMFS_IMAGE together in a global config file (e.g. local.conf)
rather than making either of them recipe specific.

> This all seems to be "correct" to the extent that bitbake linux tries to do
> the right thing.
>
> However, I get a failure in do_bundle_initramfs- "mv: cannot stat
> 'arch/arm64/boot/Image': No such file or directory".

You don't mention what version of OE you are using? The
do_bundle_initramfs() code has historically been quite fragile,
especially around the time support for multiple kernel image types was
merged a year or two back. Everything should be OK now and fixes
should have been backported to releases, but if you're using an older
release there could be a fix which didn't make it.

Are you manually over-riding KERNEL_OUTPUT_DIR? How are you setting
KERNEL_IMAGETYPE, KERNEL_ALT_IMAGETYPE, KERNEL_IMAGETYPES and
KERNEL_IMAGETYPE_FOR_MAKE?

Note that setting a kernel image type of "Image.gz" didn't work until
relatively recently. I'm not sure how far that fix got backported (if
at all).

> To the best of my (limited) debugging abilities with Yocto, it seems like
> the kernel image backup has already been run when it gets to this point and
> the Image file in that directory has already been moved to Image.bak. If I
> comment out the mv statement in kernel.bbclass causing the failure, the
> process continues, but the initramfs does not seem to get populated or
> perhaps installed into my kernel image as I get kernel panics that I have
> been unable to get past.

The error is odd as the mv commands in do_bundle_initramfs() are only
run to backup kernel images (or symlinks to images) as
do_bundle_initramfs() finds them, or to rename a kernel image after a
call to kernel_do_compile() to create it.

You don't mention specifically which mv command in
do_bundle_initramfs() is failing. If it's after the call to
kernel_do_compile() then it suggests that kernel_do_compile() isn't
creating the expected kernel image (or isn't creating it in the
expected directory).

If you add a few "ls" commands to do_bundle_initramfs() it should be
fairly easy to see where files are (and whether or not they are
symlinks) before and after the call to kernel_do_compile() from the
do_bundle_initramfs() log.

> I decided to take a different approach and try using the
> core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
> the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I can
> even seem to boot into this initramfs- it counts down waiting for removable
> media; seems to find my primary rootfs on sda3, but there is no rootfs.img
> file there so says it is dropping to a shell (although I never get a
> prompt...).
>
> Thinking I could start with that recipe and work to get rid of the live
> stuff and just get to a busybox prompt before trying to run my unique init
> commands, I copied  core-image-minimal-initramfs.bb to my-
> core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE to
> "my- core-image-minimal-initramfs".
> However, I obviously missed something in the configuration as I get an error
> in go_bundle_initramfs again:
>      kernel-source/scripts/gen_initramfs_list.sh:
>                  Cannot open
> '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
>
> Any help would be greatly appreciated.
> Thank you!
> --
>
> .Tim
>
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>


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

* Re: struggling with initramfs
  2018-07-03 18:02 struggling with initramfs Tim Hammer
  2018-07-03 22:00 ` Prakash Ks
  2018-07-03 23:33 ` Andre McCurdy
@ 2018-07-04 18:57 ` Ferry Toth
  2018-07-05  6:23   ` Zoran Stojsavljevic
  2018-07-07 19:02 ` Ferry Toth
  3 siblings, 1 reply; 8+ messages in thread
From: Ferry Toth @ 2018-07-04 18:57 UTC (permalink / raw)
  To: yocto

Tim Hammer wrote:

> Can anyone point me to a step-by-step tutorial or simple how-to on
> creating and using an initramfs with my kernel for ARM aarch64?
> 
> 
> I have tried creating my own:
>  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
>  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"
> 
> This all seems to be "correct" to the extent that bitbake linux tries to
> do the right thing.
> 
> However, I get a failure in do_bundle_initramfs- "mv: cannot stat
> 'arch/arm64/boot/Image': No such file or directory".
> 
> To the best of my (limited) debugging abilities with Yocto, it seems like
> the kernel image backup has already been run when it gets to this point
> and the Image file in that directory has already been moved to Image.bak.
> If I comment out the mv statement in kernel.bbclass causing the failure,
> the process continues, but the initramfs does not seem to get populated or
> perhaps installed into my kernel image as I get kernel panics that I have
> been unable to get past.
> 
> 
> I decided to take a different approach and try using the
> core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
> the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
> can even seem to boot into this initramfs- it counts down waiting for
> removable media; seems to find my primary rootfs on sda3, but there is no
> rootfs.img file there so says it is dropping to a shell (although I never
> get a prompt...).

We have taken this approach here 
https://github.com/edison-fw/meta-intel-edison/tree/master/meta-intel-edison-distro/recipes-core

There are 2 images, the rootfs and the initramfs. And we overload the init-live.sh 
to load certain kernel modules and acpi-tables then switchroot to the rootfs.

> Thinking I could start with that recipe and work to get rid of the live
> stuff and just get to a busybox prompt before trying to run my unique init
> commands, I copied  core-image-minimal-initramfs.bb to my-
> core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE to
> "my- core-image-minimal-initramfs".
> However, I obviously missed something in the configuration as I get an
> error in go_bundle_initramfs again:
>      kernel-source/scripts/gen_initramfs_list.sh:
>                  Cannot open
> '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
> 
> Any help would be greatly appreciated.
> Thank you!




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

* Re: struggling with initramfs
  2018-07-04 18:57 ` Ferry Toth
@ 2018-07-05  6:23   ` Zoran Stojsavljevic
  2018-07-06  1:13     ` Andre McCurdy
  0 siblings, 1 reply; 8+ messages in thread
From: Zoran Stojsavljevic @ 2018-07-05  6:23 UTC (permalink / raw)
  To: tdhammer99, Andre McCurdy, ftoth, prakashpks15; +Cc: Yocto Project

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

Hello to all,

I have my own YOCTO recipe how I do the initramfs.

Usually, some of these are missing in kernel .config file:

CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y

Please, check (they should be on) the CONFIG_DECOMPRESS_* options and if
not, please, turn them on.

To do this, please, for YOCTO use the following (to reconfigure kernel
.config):
bitbake -c menuconfig virtual/kernel

Also, in the local.conf I have the following set:

DISTRO_FEATURES_append = " ram"
IMAGE_FSTYPES_append = " cpio.xz"

Then I do: bitbake -k core-image-minimal, and from:
.../build/tmp/tmp/deploy/images/<platform_name>

Take my <initramfs_name>.cpio.xz as initramfs. Also, I take accordingly
zImage and .dtb files as well.

I prepend to initramfs.cpio.xz u-boot header:
mkimage -n 'Ramdisk Image'  -A arm -O linux -T ramdisk -C gzip -d
initramfs.cpio.xz initramfs.cpio.xz.uboot

And then write tiny U-Boot ash script to tftp (from host) all three files
to the target platform.

Works like a charm!

Zoran
_______


On Wed, Jul 4, 2018 at 8:57 PM, Ferry Toth <ftoth@telfort.nl> wrote:

> Tim Hammer wrote:
>
> > Can anyone point me to a step-by-step tutorial or simple how-to on
> > creating and using an initramfs with my kernel for ARM aarch64?
> >
> >
> > I have tried creating my own:
> >  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
> >  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
> >  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"
> >
> > This all seems to be "correct" to the extent that bitbake linux tries to
> > do the right thing.
> >
> > However, I get a failure in do_bundle_initramfs- "mv: cannot stat
> > 'arch/arm64/boot/Image': No such file or directory".
> >
> > To the best of my (limited) debugging abilities with Yocto, it seems like
> > the kernel image backup has already been run when it gets to this point
> > and the Image file in that directory has already been moved to Image.bak.
> > If I comment out the mv statement in kernel.bbclass causing the failure,
> > the process continues, but the initramfs does not seem to get populated
> or
> > perhaps installed into my kernel image as I get kernel panics that I have
> > been unable to get past.
> >
> >
> > I decided to take a different approach and try using the
> > core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
> > the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
> > can even seem to boot into this initramfs- it counts down waiting for
> > removable media; seems to find my primary rootfs on sda3, but there is no
> > rootfs.img file there so says it is dropping to a shell (although I never
> > get a prompt...).
>
> We have taken this approach here
> https://github.com/edison-fw/meta-intel-edison/tree/master/
> meta-intel-edison-distro/recipes-core
>
> There are 2 images, the rootfs and the initramfs. And we overload the
> init-live.sh
> to load certain kernel modules and acpi-tables then switchroot to the
> rootfs.
>
> > Thinking I could start with that recipe and work to get rid of the live
> > stuff and just get to a busybox prompt before trying to run my unique
> init
> > commands, I copied  core-image-minimal-initramfs.bb to my-
> > core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE
> to
> > "my- core-image-minimal-initramfs".
> > However, I obviously missed something in the configuration as I get an
> > error in go_bundle_initramfs again:
> >      kernel-source/scripts/gen_initramfs_list.sh:
> >                  Cannot open
> > '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-
> minimal-initramfs-{machine}.cpio'
> >
> > Any help would be greatly appreciated.
> > Thank you!
>
>
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

[-- Attachment #2: Type: text/html, Size: 5457 bytes --]

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

* Re: struggling with initramfs
  2018-07-05  6:23   ` Zoran Stojsavljevic
@ 2018-07-06  1:13     ` Andre McCurdy
  2018-07-06  6:56       ` Zoran Stojsavljevic
  0 siblings, 1 reply; 8+ messages in thread
From: Andre McCurdy @ 2018-07-06  1:13 UTC (permalink / raw)
  To: Zoran Stojsavljevic; +Cc: Yocto Project, ftoth

On Wed, Jul 4, 2018 at 11:23 PM, Zoran Stojsavljevic
<zoran.stojsavljevic@gmail.com> wrote:
> Hello to all,
>
> I have my own YOCTO recipe how I do the initramfs.
>
> Usually, some of these are missing in kernel .config file:
>
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_RD_GZIP=y
> CONFIG_RD_BZIP2=y
> CONFIG_RD_LZMA=y
> CONFIG_RD_XZ=y
> CONFIG_RD_LZO=y
> CONFIG_RD_LZ4=y
>
> Please, check (they should be on) the CONFIG_DECOMPRESS_* options and if
> not, please, turn them on.
>
> To do this, please, for YOCTO use the following (to reconfigure kernel
> .config):
> bitbake -c menuconfig virtual/kernel
>
> Also, in the local.conf I have the following set:
>
> DISTRO_FEATURES_append = " ram"

There is no standard distro feature called "ram". Perhaps this is
something specific to your BSP layer?

> IMAGE_FSTYPES_append = " cpio.xz"
>
> Then I do: bitbake -k core-image-minimal, and from:
> .../build/tmp/tmp/deploy/images/<platform_name>
>
> Take my <initramfs_name>.cpio.xz as initramfs. Also, I take accordingly
> zImage and .dtb files as well.
>
> I prepend to initramfs.cpio.xz u-boot header:
> mkimage -n 'Ramdisk Image'  -A arm -O linux -T ramdisk -C gzip -d
> initramfs.cpio.xz initramfs.cpio.xz.uboot
>
> And then write tiny U-Boot ash script to tftp (from host) all three files to
> the target platform.

This advice and these instructions are all fine. However, just for the
record, creating a standalone cpio archive and arranging for the
bootloader to load the kernel and cpio archive into DRAM as separate
images before booting the kernel is not solving the same problem as
embedding a cpio archive inside the kernel image via OE's
INITRAMFS_IMAGE_BUNDLE option.

> On Wed, Jul 4, 2018 at 8:57 PM, Ferry Toth <ftoth@telfort.nl> wrote:
>>
>> Tim Hammer wrote:
>>
>> > Can anyone point me to a step-by-step tutorial or simple how-to on
>> > creating and using an initramfs with my kernel for ARM aarch64?
>> >
>> >
>> > I have tried creating my own:
>> >  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
>> >  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>> >  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"
>> >
>> > This all seems to be "correct" to the extent that bitbake linux tries to
>> > do the right thing.
>> >
>> > However, I get a failure in do_bundle_initramfs- "mv: cannot stat
>> > 'arch/arm64/boot/Image': No such file or directory".
>> >
>> > To the best of my (limited) debugging abilities with Yocto, it seems
>> > like
>> > the kernel image backup has already been run when it gets to this point
>> > and the Image file in that directory has already been moved to
>> > Image.bak.
>> > If I comment out the mv statement in kernel.bbclass causing the failure,
>> > the process continues, but the initramfs does not seem to get populated
>> > or
>> > perhaps installed into my kernel image as I get kernel panics that I
>> > have
>> > been unable to get past.
>> >
>> >
>> > I decided to take a different approach and try using the
>> > core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting
>> > out
>> > the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
>> > can even seem to boot into this initramfs- it counts down waiting for
>> > removable media; seems to find my primary rootfs on sda3, but there is
>> > no
>> > rootfs.img file there so says it is dropping to a shell (although I
>> > never
>> > get a prompt...).
>>
>> We have taken this approach here
>>
>> https://github.com/edison-fw/meta-intel-edison/tree/master/meta-intel-edison-distro/recipes-core
>>
>> There are 2 images, the rootfs and the initramfs. And we overload the
>> init-live.sh
>> to load certain kernel modules and acpi-tables then switchroot to the
>> rootfs.
>>
>> > Thinking I could start with that recipe and work to get rid of the live
>> > stuff and just get to a busybox prompt before trying to run my unique
>> > init
>> > commands, I copied  core-image-minimal-initramfs.bb to my-
>> > core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE
>> > to
>> > "my- core-image-minimal-initramfs".
>> > However, I obviously missed something in the configuration as I get an
>> > error in go_bundle_initramfs again:
>> >      kernel-source/scripts/gen_initramfs_list.sh:
>> >                  Cannot open
>> >
>> > '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
>> >
>> > Any help would be greatly appreciated.
>> > Thank you!
>>
>>
>> --
>> _______________________________________________
>> yocto mailing list
>> yocto@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
>
>


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

* Re: struggling with initramfs
  2018-07-06  1:13     ` Andre McCurdy
@ 2018-07-06  6:56       ` Zoran Stojsavljevic
  0 siblings, 0 replies; 8+ messages in thread
From: Zoran Stojsavljevic @ 2018-07-06  6:56 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: Yocto Project, ftoth

> There is no standard distro feature called "ram". Perhaps this is
> something specific to your BSP layer?

Yeah, I noticed that. There is " nfs" parameter, but looks somehow
peculiar: not in line with initramfs creation.

I know that the whole line: DISTRO_FEATURES_append = " ram" looks
bogus/useless, but YOCTO build system does not complain either.

Maybe, you YOCTO guys, you do want to do some action about it? ;-)

> This advice and these instructions are all fine. However, just for the
> record, creating a standalone cpio archive and arranging for the
> bootloader to load the kernel and cpio archive into DRAM as separate
> images before booting the kernel is not solving the same problem as
> embedding a cpio archive inside the kernel image via OE's
> INITRAMFS_IMAGE_BUNDLE option.

Another excellent observation! I do create test creations, mainly test
vehicles for the boards/platforms these days. And for this, better to
have splited zImage and initramfs.cpio.xz. The reason is very obvious:
this is the scalability problem, and sometimes I need/require to swap
parts in this equation!

If the final production image is to be prepared, especially for final
static rootfs-es with well defined applications on hard drives, the
bundle (kernel+initramfs) will be just fine/excellent transient
solution!

Zoran
_______

On Fri, Jul 6, 2018 at 3:13 AM, Andre McCurdy <armccurdy@gmail.com> wrote:
> On Wed, Jul 4, 2018 at 11:23 PM, Zoran Stojsavljevic
> <zoran.stojsavljevic@gmail.com> wrote:
>> Hello to all,
>>
>> I have my own YOCTO recipe how I do the initramfs.
>>
>> Usually, some of these are missing in kernel .config file:
>>
>> CONFIG_BLK_DEV_INITRD=y
>> CONFIG_RD_GZIP=y
>> CONFIG_RD_BZIP2=y
>> CONFIG_RD_LZMA=y
>> CONFIG_RD_XZ=y
>> CONFIG_RD_LZO=y
>> CONFIG_RD_LZ4=y
>>
>> Please, check (they should be on) the CONFIG_DECOMPRESS_* options and if
>> not, please, turn them on.
>>
>> To do this, please, for YOCTO use the following (to reconfigure kernel
>> .config):
>> bitbake -c menuconfig virtual/kernel
>>
>> Also, in the local.conf I have the following set:
>>
>> DISTRO_FEATURES_append = " ram"
>
> There is no standard distro feature called "ram". Perhaps this is
> something specific to your BSP layer?
>
>> IMAGE_FSTYPES_append = " cpio.xz"
>>
>> Then I do: bitbake -k core-image-minimal, and from:
>> .../build/tmp/tmp/deploy/images/<platform_name>
>>
>> Take my <initramfs_name>.cpio.xz as initramfs. Also, I take accordingly
>> zImage and .dtb files as well.
>>
>> I prepend to initramfs.cpio.xz u-boot header:
>> mkimage -n 'Ramdisk Image'  -A arm -O linux -T ramdisk -C gzip -d
>> initramfs.cpio.xz initramfs.cpio.xz.uboot
>>
>> And then write tiny U-Boot ash script to tftp (from host) all three files to
>> the target platform.
>
> This advice and these instructions are all fine. However, just for the
> record, creating a standalone cpio archive and arranging for the
> bootloader to load the kernel and cpio archive into DRAM as separate
> images before booting the kernel is not solving the same problem as
> embedding a cpio archive inside the kernel image via OE's
> INITRAMFS_IMAGE_BUNDLE option.
>
>> On Wed, Jul 4, 2018 at 8:57 PM, Ferry Toth <ftoth@telfort.nl> wrote:
>>>
>>> Tim Hammer wrote:
>>>
>>> > Can anyone point me to a step-by-step tutorial or simple how-to on
>>> > creating and using an initramfs with my kernel for ARM aarch64?
>>> >
>>> >
>>> > I have tried creating my own:
>>> >  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
>>> >  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>>> >  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"
>>> >
>>> > This all seems to be "correct" to the extent that bitbake linux tries to
>>> > do the right thing.
>>> >
>>> > However, I get a failure in do_bundle_initramfs- "mv: cannot stat
>>> > 'arch/arm64/boot/Image': No such file or directory".
>>> >
>>> > To the best of my (limited) debugging abilities with Yocto, it seems
>>> > like
>>> > the kernel image backup has already been run when it gets to this point
>>> > and the Image file in that directory has already been moved to
>>> > Image.bak.
>>> > If I comment out the mv statement in kernel.bbclass causing the failure,
>>> > the process continues, but the initramfs does not seem to get populated
>>> > or
>>> > perhaps installed into my kernel image as I get kernel panics that I
>>> > have
>>> > been unable to get past.
>>> >
>>> >
>>> > I decided to take a different approach and try using the
>>> > core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting
>>> > out
>>> > the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
>>> > can even seem to boot into this initramfs- it counts down waiting for
>>> > removable media; seems to find my primary rootfs on sda3, but there is
>>> > no
>>> > rootfs.img file there so says it is dropping to a shell (although I
>>> > never
>>> > get a prompt...).
>>>
>>> We have taken this approach here
>>>
>>> https://github.com/edison-fw/meta-intel-edison/tree/master/meta-intel-edison-distro/recipes-core
>>>
>>> There are 2 images, the rootfs and the initramfs. And we overload the
>>> init-live.sh
>>> to load certain kernel modules and acpi-tables then switchroot to the
>>> rootfs.
>>>
>>> > Thinking I could start with that recipe and work to get rid of the live
>>> > stuff and just get to a busybox prompt before trying to run my unique
>>> > init
>>> > commands, I copied  core-image-minimal-initramfs.bb to my-
>>> > core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE
>>> > to
>>> > "my- core-image-minimal-initramfs".
>>> > However, I obviously missed something in the configuration as I get an
>>> > error in go_bundle_initramfs again:
>>> >      kernel-source/scripts/gen_initramfs_list.sh:
>>> >                  Cannot open
>>> >
>>> > '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
>>> >
>>> > Any help would be greatly appreciated.
>>> > Thank you!
>>>
>>>
>>> --
>>> _______________________________________________
>>> yocto mailing list
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>>
>>


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

* Re: struggling with initramfs
  2018-07-03 18:02 struggling with initramfs Tim Hammer
                   ` (2 preceding siblings ...)
  2018-07-04 18:57 ` Ferry Toth
@ 2018-07-07 19:02 ` Ferry Toth
  3 siblings, 0 replies; 8+ messages in thread
From: Ferry Toth @ 2018-07-07 19:02 UTC (permalink / raw)
  To: yocto

Tim Hammer wrote:

> Can anyone point me to a step-by-step tutorial or simple how-to on
> creating and using an initramfs with my kernel for ARM aarch64?
> 
> 
> I have tried creating my own:
>  - boot-image.bb file with IMAGE_FSTYPES = "cpio.gz".
>  - local.conf has INITRAMFS_IMAGE_BUNDLE = "1"
>  - linux.bbappend has INITRAMFS_IMAGE = "boot-image"

I just finished fixing our layer for sumo here 
https://github.com/htot/meta-intel-edison/tree/sumo64-acpi

Image recipes are here /meta-intel-edison-distro/recipes-core/images/
rootfs: edison-image
initramfs: core-image-minimal-initramfs.bbappend
conf: /meta-intel-edison-bsp/conf/machine/edison.conf
init script: /meta-intel-edison-distro/recipes-core/initrdscripts/initramfs-framework_1.0.bbappend

You should be able to find what you need in these sources.

> This all seems to be "correct" to the extent that bitbake linux tries to
> do the right thing.
> 
> However, I get a failure in do_bundle_initramfs- "mv: cannot stat
> 'arch/arm64/boot/Image': No such file or directory".
> 
> To the best of my (limited) debugging abilities with Yocto, it seems like
> the kernel image backup has already been run when it gets to this point
> and the Image file in that directory has already been moved to Image.bak.
> If I comment out the mv statement in kernel.bbclass causing the failure,
> the process continues, but the initramfs does not seem to get populated or
> perhaps installed into my kernel image as I get kernel panics that I have
> been unable to get past.
> 
> 
> I decided to take a different approach and try using the
> core-image-minimal-initramfs recipe as INITRAMFS_IMAGE. By commenting out
> the COMPATIBLE_HOST entry I am able to build a kernel for ARM aarch64. I
> can even seem to boot into this initramfs- it counts down waiting for
> removable media; seems to find my primary rootfs on sda3, but there is no
> rootfs.img file there so says it is dropping to a shell (although I never
> get a prompt...).
> 
> Thinking I could start with that recipe and work to get rid of the live
> stuff and just get to a busybox prompt before trying to run my unique init
> commands, I copied  core-image-minimal-initramfs.bb to my-
> core-image-minimal-initramfs.bb in my layer and changed INITRAMFS_IMAGE to
> "my- core-image-minimal-initramfs".
> However, I obviously missed something in the configuration as I get an
> error in go_bundle_initramfs again:
>      kernel-source/scripts/gen_initramfs_list.sh:
>                  Cannot open
> '/.../linux-qoriq/4.14-r0/build/usr/my-core-image-minimal-initramfs-{machine}.cpio'
> 
> Any help would be greatly appreciated.
> Thank you!




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

end of thread, other threads:[~2018-07-07 19:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-03 18:02 struggling with initramfs Tim Hammer
2018-07-03 22:00 ` Prakash Ks
2018-07-03 23:33 ` Andre McCurdy
2018-07-04 18:57 ` Ferry Toth
2018-07-05  6:23   ` Zoran Stojsavljevic
2018-07-06  1:13     ` Andre McCurdy
2018-07-06  6:56       ` Zoran Stojsavljevic
2018-07-07 19:02 ` Ferry Toth

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.