Skip to contentSkip to conversation

image.bbclass question

DISCUSSION Ryan Eatmon 2 participants 4 messages Aug 2, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

I am trying to add support for the INITRAMFS_MAXSIZE into the meta-ti layer for our tiny image.

I have added the following to our tiny image file:

INITRAMFS_FSTYPES += "cpio cpio.xz"
INITRAMFS_MAXSIZE = "65536"

But I'm not seeing any errors about the image being too big being printed.

In looking at the code in question:

# Check the initramfs size against INITRAMFS_MAXSIZE (if set) if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
initramfs_maxsize_int = int(initramfs_maxsize)
if base_size > initramfs_maxsize_int:
bb.error("The initramfs size %d(K) exceeds
INITRAMFS_MAXSIZE: %d(K)" % \
(base_size, initramfs_maxsize_int))
bb.error("You can set INITRAMFS_MAXSIZE a larger value.
Usually, it should")
bb.fatal("be less than 1/2 of ram size, or you may fail to
boot it.\n")

What is the purpose of the:

if image_fstypes == initramfs_fstypes != ''

It seems to looking for the ONLY images being built are the exact same as the INITRAMFS_FSTYPES... Shouldn't that be more of an intersection check? If any of the INITRAMFS_FSTYPES are in the IMAGE_FSTYPES, then check the size?

Or am I missing something?

Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
#1 lore raw

Image builds obey IMAGE_FSTYPES. Initramfs images set that to INITRAMFS_FSTYPES, so it's comparing the two as a check to see if this is an initramfs image. It isn't making sure it matches a hardcoded list, so intersection isn't necessary.

Quoted 56 lines · Ryan Eatmon via lists.openembedded.org

I am trying to add support for the INITRAMFS_MAXSIZE into the meta-ti layer for our tiny image.

I have added the following to our tiny image file:

INITRAMFS_FSTYPES += "cpio cpio.xz"
INITRAMFS_MAXSIZE = "65536"

But I'm not seeing any errors about the image being too big being printed.

In looking at the code in question:

# Check the initramfs size against INITRAMFS_MAXSIZE (if set) if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize:
initramfs_maxsize_int = int(initramfs_maxsize)
if base_size > initramfs_maxsize_int:
bb.error("The initramfs size %d(K) exceeds
INITRAMFS_MAXSIZE: %d(K)" % \
(base_size, initramfs_maxsize_int))
bb.error("You can set INITRAMFS_MAXSIZE a larger value.
Usually, it should")
bb.fatal("be less than 1/2 of ram size, or you may fail to
boot it.\n")

What is the purpose of the:

if image_fstypes == initramfs_fstypes != ''

It seems to looking for the ONLY images being built are the exact same as the INITRAMFS_FSTYPES... Shouldn't that be more of an intersection check? If any of the INITRAMFS_FSTYPES are in the IMAGE_FSTYPES, then check the size?

Or am I missing something?

--
Ryan Eatmon [email protected]
-----------------------------------------
Texas Instruments, Inc. - LCPD - MGTS

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#185415):
https://lists.openembedded.org/g/openembedded-core/message/185415
Mute This Topic: https://lists.openembedded.org/mt/100509426/3617123
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 4 lines
Christopher Larson
[email protected], [email protected], [email protected]
Principal Software Engineer, Embedded Linux Solutions, Siemens Digital
Industries Software
#2 lore raw

I added some debugging to print out the various variables on interest and got this output:

DEBUG: image_fstypes= tar.xz wic.xz wic.bmap tar.xz.md5sum cpio cpio.xz
DEBUG: initramfs_fstypes=cpio.gz cpio cpio.xz
DEBUG: initramfs_maxsize=65536.000000
DEBUG: base_size=74366

So I'm not sure I agree with what you are saying. Again, I might be missing something in how the == is supposed to work when comparing the two variables...

Quoted 73 lines · Christopher Larson

Image builds obey IMAGE_FSTYPES. Initramfs images set that to INITRAMFS_FSTYPES, so it's comparing the two as a check to see if this is an initramfs image. It isn't making sure it matches a hardcoded list, so intersection isn't necessary.

On Wed, Aug 2, 2023 at 9:41 AM Ryan Eatmon via lists.openembedded.org <http://lists.openembedded.org> <[email protected] <mailto:[email protected]>> wrote:

I am trying to add support for the INITRAMFS_MAXSIZE into the meta-ti layer for our tiny image.

I have added the following to our tiny image file:

INITRAMFS_FSTYPES += "cpio cpio.xz"
INITRAMFS_MAXSIZE = "65536"

But I'm not seeing any errors about the image being too big being printed.

In looking at the code in question:

     # Check the initramfs size against INITRAMFS_MAXSIZE (if set) if image_fstypes == initramfs_fstypes != ''  and
initramfs_maxsize:
         initramfs_maxsize_int = int(initramfs_maxsize) if base_size > initramfs_maxsize_int:
             bb.error("The initramfs size %d(K) exceeds
INITRAMFS_MAXSIZE: %d(K)" % \
                 (base_size, initramfs_maxsize_int)) bb.error("You can set INITRAMFS_MAXSIZE a larger value.
Usually, it should")
             bb.fatal("be less than 1/2 of ram size, or you may
fail to
boot it.\n")

What is the purpose of the:

if image_fstypes == initramfs_fstypes != ''

It seems to looking for the ONLY images being built are the exact same as the INITRAMFS_FSTYPES...  Shouldn't that be more of an intersection check?  If any of the INITRAMFS_FSTYPES are in the IMAGE_FSTYPES, then check the size?

Or am I missing something?

--
Ryan Eatmon [email protected] <mailto:[email protected]>
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#185415):
https://lists.openembedded.org/g/openembedded-core/message/185415
<https://lists.openembedded.org/g/openembedded-core/message/185415>
Mute This Topic: https://lists.openembedded.org/mt/100509426/3617123
<https://lists.openembedded.org/mt/100509426/3617123>
Group Owner: [email protected] <mailto:openembedded-core%[email protected]> Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub
<https://lists.openembedded.org/g/openembedded-core/unsub>
[[email protected] <mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Christopher Larson
[email protected], [email protected], [email protected]
Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software
Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

In looking at the poky tiny initramfs image, it sets:

IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"

Which would then make the two variable the same and make the check kick in. But I cannot find where it manual says that you have to make them the same value and cannot generate an initramfs image along with all other image types.

Quoted 81 lines · Ryan Eatmon via lists.openembedded.org

I added some debugging to print out the various variables on interest and got this output:

DEBUG: image_fstypes= tar.xz wic.xz wic.bmap tar.xz.md5sum cpio cpio.xz
DEBUG: initramfs_fstypes=cpio.gz cpio cpio.xz
DEBUG: initramfs_maxsize=65536.000000
DEBUG: base_size=74366

So I'm not sure I agree with what you are saying.  Again, I might be missing something in how the == is supposed to work when comparing the two variables...

Quoted 43 lines · Christopher Larson

Image builds obey IMAGE_FSTYPES. Initramfs images set that to INITRAMFS_FSTYPES, so it's comparing the two as a check to see if this is an initramfs image. It isn't making sure it matches a hardcoded list, so intersection isn't necessary.

On Wed, Aug 2, 2023 at 9:41 AM Ryan Eatmon via lists.openembedded.org <http://lists.openembedded.org> <[email protected] <mailto:[email protected]>> wrote:

    I am trying to add support for the INITRAMFS_MAXSIZE into the meta-ti layer for our tiny image.

    I have added the following to our tiny image file:

    INITRAMFS_FSTYPES += "cpio cpio.xz"
    INITRAMFS_MAXSIZE = "65536"

    But I'm not seeing any errors about the image being too big being printed.

    In looking at the code in question:

          # Check the initramfs size against INITRAMFS_MAXSIZE (if set) if image_fstypes == initramfs_fstypes != ''  and initramfs_maxsize:
              initramfs_maxsize_int = int(initramfs_maxsize) if base_size > initramfs_maxsize_int:
                  bb.error("The initramfs size %d(K) exceeds
    INITRAMFS_MAXSIZE: %d(K)" % \
                      (base_size, initramfs_maxsize_int)) bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
                  bb.fatal("be less than 1/2 of ram size, or you may fail to
    boot it.\n")

    What is the purpose of the:

    if image_fstypes == initramfs_fstypes != ''

    It seems to looking for the ONLY images being built are the exact same as the INITRAMFS_FSTYPES...  Shouldn't that be more of an intersection check?  If any of the INITRAMFS_FSTYPES are in the IMAGE_FSTYPES, then check the size?

Quoted 15 lines

    Or am I missing something?

    --     Ryan Eatmon [email protected] <mailto:[email protected]>
    -----------------------------------------
    Texas Instruments, Inc.  -  LCPD  -  MGTS

Signature · 3 lines
Christopher Larson
[email protected], [email protected], [email protected]
Principal Software Engineer, Embedded Linux Solutions, Siemens Digital Industries Software

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185425): https://lists.openembedded.org/g/openembedded-core/message/185425
Mute This Topic: https://lists.openembedded.org/mt/100509426/6551054
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS