How to include gcc in initramfs (core-image-minimal-initramfs) for i.MX8MP QSPI-only boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to include gcc in initramfs (core-image-minimal-initramfs) for i.MX8MP QSPI-only boot

880 Views
Bhardwaj
Contributor II

Hi ,

I am working on an i.MX8M Plus DDR4 custom board and I am able to successfully boot the system entirely from QSPI flash (32MB).

My current boot components are:

  1. flash.bin (U-Boot)

  2. Image.gz (Linux kernel)

  3. imx8mp-ddr4-evk.dtb

  4. core-image-minimal-initramfs.cpio.gz

Since my board does not have SD card or eMMC, I am using initramfs as the root filesystem.

Now I want to include gcc inside core-image-minimal-initramfs.cpio.gz, so that I can compile applications directly on the target without relying on any external storage.

Changed the conf/local.conf and then build using command

bitbake core-image-minimal-initramfs

Also attached the local.conf file for your reference.

It generated  core-image-minimal-initramfs.cpio.gz but gcc is not present in that /bin folder and getting like below.

~ # gcc
/bin/sh: gcc: not found


~ # ls
bin dev home init.d media proc run sys usr
boot etc init lib mnt root sbin tmp var

Could you please advise:

  • What is the correct Yocto method to include gcc in an initramfs image?

  • Are there any recommended configurations or limitations when using gcc inside initramfs (RAM usage, image size, etc.)?

Any guidance or reference to NXP-supported Yocto practices would be very helpful.

Thank You.

0 Kudos
Reply
3 Replies

778 Views
pengyong_zhang
NXP Employee
NXP Employee

Hi @Bhardwaj 

You want to put all of the Image to your QSPI flash(32MB)? If yes, then it's too small to contain gcc.

B.R

0 Kudos
Reply

819 Views
pengyong_zhang
NXP Employee
NXP Employee

Hi @Bhardwaj 

Sorry to reply late, you can add the below code in local.conf file

IMAGE_INSTALL:append = " gcc binutils glibc-utils libgcc-dev make" 

B.R

0 Kudos
Reply

805 Views
Bhardwaj
Contributor II

Hi @pengyong_zhang ,

I added the following line to conf/local.conf: 

IMAGE_INSTALL:append = " gcc binutils glibc-utils libgcc-dev make" 

 However, after rebuilding $bitbake core-image-minimal-initramfs, gcc is still not included in core-image-minimal-initramfs.cpio.gz

When i check cpio.gz , gcc is not found (please see the attached screenshot).

Bhardwaj_0-1770035606785.png

Could you please let me know if I’m missing something or if additional configuration is required to include gcc in the initramfs image?

 

Thank you.

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2303402%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20include%20gcc%20in%20initramfs%20(core-image-minimal-initramfs)%20for%20i.MX8MP%20QSPI-only%20boot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2303402%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%2C%3C%2FP%3E%3CP%3EI%20am%20working%20on%20an%20%3CSTRONG%3Ei.MX8M%20Plus%20DDR4%20custom%20board%3C%2FSTRONG%3E%20and%20I%20am%20able%20to%20successfully%20boot%20the%20system%20%3CSTRONG%3Eentirely%20from%20QSPI%20flash%20(32MB)%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EMy%20current%20boot%20components%20are%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3Eflash.bin%20(U-Boot)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EImage.gz%20(Linux%20kernel)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3Eimx8mp-ddr4-evk.dtb%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3Ecore-image-minimal-initramfs.cpio.gz%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3ESince%20my%20board%20%3CSTRONG%3Edoes%20not%20have%20SD%20card%20or%20eMMC%3C%2FSTRONG%3E%2C%20I%20am%20using%20%3CSTRONG%3Einitramfs%20as%20the%20root%20filesystem%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3ENow%20I%20want%20to%20%3CSTRONG%3Einclude%20gcc%20inside%20core-image-minimal-initramfs.cpio.gz%3C%2FSTRONG%3E%2C%20so%20that%20I%20can%20compile%20applications%20directly%20on%20the%20target%20without%20relying%20on%20any%20external%20storage.%3C%2FP%3E%3CP%3EChanged%20the%20conf%2Flocal.conf%20and%20then%20build%20using%20command%3C%2FP%3E%3CP%3Ebitbake%20core-image-minimal-initramfs%3C%2FP%3E%3CP%3EAlso%20attached%20the%20local.conf%20file%20for%20your%20reference.%3C%2FP%3E%3CP%3EIt%20generated%26nbsp%3B%26nbsp%3B%3CSTRONG%3Ecore-image-minimal-initramfs.cpio.gz%26nbsp%3Bbut%20gcc%20is%20not%20present%20in%20that%20%2Fbin%20folder%20and%20getting%20like%20below.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E~%3CSTRONG%3E%20%23%20gcc%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2Fbin%2Fsh%3A%20gcc%3A%20not%20found%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3E~%20%23%20ls%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Ebin%20dev%20home%20init.d%20media%20proc%20run%20sys%20usr%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Eboot%20etc%20init%20lib%20mnt%20root%20sbin%20tmp%20var%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ECould%20you%20please%20advise%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3EWhat%20is%20the%20%3CSTRONG%3Ecorrect%20Yocto%20method%3C%2FSTRONG%3E%20to%20include%20gcc%20in%20an%20initramfs%20image%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EAre%20there%20any%20%3CSTRONG%3Erecommended%20configurations%20or%20limitations%3C%2FSTRONG%3E%20when%20using%20gcc%20inside%20initramfs%20(RAM%20usage%2C%20image%20size%2C%20etc.)%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EAny%20guidance%20or%20reference%20to%20NXP-supported%20Yocto%20practices%20would%20be%20very%20helpful.%3C%2FP%3E%3CP%3EThank%20You.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2304641%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20include%20gcc%20in%20initramfs%20(core-image-minimal-initramfs)%20for%20i.MX8MP%20QSPI-only%20boot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2304641%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F202673%22%20target%3D%22_blank%22%3E%40pengyong_zhang%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3EI%20added%20the%20following%20line%20to%20conf%2Flocal.conf%3A%26nbsp%3B%3C%2FP%3E%3CPRE%3EIMAGE_INSTALL%3Aappend%20%3D%20%22%20gcc%20binutils%20glibc-utils%20libgcc-dev%20make%22%26nbsp%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3BHowever%2C%20after%20rebuilding%3CSTRONG%3E%20%24bitbake%20core-image-minimal-initramfs%2C%3C%2FSTRONG%3E%20gcc%20is%20still%20not%20included%20in%20core-image-minimal-initramfs.cpio.gz%3C%2FP%3E%3CP%3EWhen%20i%20check%20cpio.gz%20%2C%20gcc%20is%20not%20found%20(please%20see%20the%20attached%20screenshot).%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Bhardwaj_0-1770035606785.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Bhardwaj_0-1770035606785.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Bhardwaj_0-1770035606785.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Bhardwaj_0-1770035606785.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375164i468DF4BC1772B1DF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Bhardwaj_0-1770035606785.png%22%20alt%3D%22Bhardwaj_0-1770035606785.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ECould%20you%20please%20let%20me%20know%20if%20I%E2%80%99m%20missing%20something%20or%20if%20additional%20configuration%20is%20required%20to%20include%20gcc%20in%20the%20initramfs%20image%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThank%20you.%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2304500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20include%20gcc%20in%20initramfs%20(core-image-minimal-initramfs)%20for%20i.MX8MP%20QSPI-only%20boot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2304500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F254971%22%20target%3D%22_blank%22%3E%40Bhardwaj%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESorry%20to%20reply%20late%2C%20you%20can%20add%20the%20below%20code%20in%20local.conf%20file%3C%2FP%3E%0A%3CPRE%3EIMAGE_INSTALL%3Aappend%20%3D%20%22%20gcc%20binutils%20glibc-utils%20libgcc-dev%20make%22%26nbsp%3B%3C%2FPRE%3E%0A%3CP%3EB.R%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2305639%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20include%20gcc%20in%20initramfs%20(core-image-minimal-initramfs)%20for%20i.MX8MP%20QSPI-only%20boot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2305639%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F254971%22%20target%3D%22_blank%22%3E%40Bhardwaj%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20want%20to%20put%20all%20of%20the%20Image%20to%20your%20QSPI%20flash(32MB)%3F%20If%20yes%2C%20then%20it's%20too%20small%20to%20contain%20gcc.%3C%2FP%3E%0A%3CP%3EB.R%3C%2FP%3E%3C%2FLINGO-BODY%3E