How to add custom application to linux rootfs.

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

How to add custom application to linux rootfs.

Jump to solution
12,753 Views
chandrashekhar
Contributor III

Hi,

I am using QorIQ sdk for t1042 and want to add application/files to rootfs system. Can someone help me on how to do this? I am using bitbake for compilation.

Regards,

Chandra

Tags (1)
0 Kudos
1 Solution
4,357 Views
addiyi
NXP Employee
NXP Employee

Try this path: \meta-fsl-networking\recipes-extended\merge-files\files\merge\

Adrian

View solution in original post

0 Kudos
13 Replies
4,357 Views
addiyi
NXP Employee
NXP Employee

To add a file in rootfs:

- copy files to meta-fsl-networking/recipes-tools/merge-files/files/merge/

- make sure package 'merge-files' in the IMAGE_INSTALL list of rootfs recipe

- bitbake <image_type>

Adrian

0 Kudos
4,357 Views
chandrashekhar
Contributor III

Hi Adrian,

I could not see recipes-tools/ folder inside meta-fsl-networking/. here is the folder list from meta-fsl-networking,

~/SDK/QorIQ-SDK-T1040-BSP0.2-20140310-yocto/meta-fsl-networking$ ls

conf             packagegroups  recipes-connectivity  recipes-dpaa      recipes-multimedia        

custom-licenses  README         recipes-core          recipes-extended  recipes-support

images           recipes-bsp    recipes-devtools      recipes-kernel    recipes-virtualization

~/

Do I need to run any patch or command to get recipes-tools ?

Regards,

Chandra

0 Kudos
4,358 Views
addiyi
NXP Employee
NXP Employee

Try this path: \meta-fsl-networking\recipes-extended\merge-files\files\merge\

Adrian

0 Kudos
4,357 Views
misakamikoto
Contributor III

Hi Adrian:

   I follow this step and have some problems.See this thread for detail.question about customize rootfs by using mergefiles

Can you give me some suggestions,thanks!

0 Kudos
4,357 Views
chandrashekhar
Contributor III

Thanks Adrian,

I could see the files added to rootfs as you mentioned above. I have few more questions on this ,

1) Is there any way to increase the size of partitions on file system like, what is the procedure to increase the size of /dev/root

oot@t1040rdb:/run# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root       100M   78M   18M  82% /

devtmpfs        926M  4.0K  926M   1% /dev

tmpfs           972M   75M  898M   8% /run

tmpfs           972M   92K  972M   1% /var/volatile

root@t1040rdb:

2) Is there any way to compile the root filesystem  using powerpc installed toolchain rather than bitbake?

Regards,

Chandra

0 Kudos
4,357 Views
caryo_brien
Contributor III

Chandra,

I was able to make a bigger root file system by creating my own image recipe based

on core-image-minimal, and adding

   IMAGE_ROOTFS_SIZE = "80000"

It might be possible to specify this other places, too.

Having our own image target also let me add extra packages, i..e

  IMAGE_INSTALL += " strace gdb dropbear "

If you want to compile applications outside of bitbake, there is a bitbake target

called "meta-ide-support" that can be run.  This creates an environment file

in work like

   environment-setup-ppce500v2-fsl-linux-gnuspe

This has env vars and path settings to get the toolchain that bitbake built.

It can be sourced to set up the build environment.

This worked for a lot of, but not all, of our application code.  Some existing

makefiles needed to be adjusted.

Hope that helps.  I'm just a beginner at Yocto so there might be better ways.

-- cary

0 Kudos
4,357 Views
chandrashekhar
Contributor III


Hi Cary,

I already have toolchain installed generated from bitbake and enviornment variable set. Using this toolchain, I can build linux uImage and u-boot. But I don't know how to build file system using this toolcahin. Can you help me on building filesystem using installed toolchain?

-Chandra

0 Kudos
4,357 Views
caryo_brien
Contributor III

I'm not 100% sure I understand what you're trying to do.

The bitbake target 'fsl-image-minimal'  will create a jffs2 image

for you, i..e tmp/deploy/images/ffsl-image-minimal-p1022ds.*, there

are ext2, jffs2, and ubi versions created.

If you want to create a rootfs image OUTSIDE of bitbake, that's a fair amount

of work.  The way we did this in older projects was to create the desired

root file system in a directory on the build machine, with all the files, scripts

and device nodes, then wrap that up into a jffs2 image with mkfs.jffs2.

It may be easier to stay within bitbake and customize the rootfs that

gets created.

-- cary

0 Kudos
4,357 Views
chandrashekhar
Contributor III


Hi Cary,

Right now I will try to modify the rootfs using bibake only. I followed steps as you mentioned to increase the size of  /root partition. But I saw some warnings while loading of linux image,

......

RAMDISK: gzip image found at block 0

scsi0 : usb-storage 2-1.1:1.0

RAMDISK: incomplete write (10819 != 32768)

write error

.......

Also, after adding this IMAGE_ROOTFS_SIZE = "80000" , I am not getting where it increase the size?

root@t1040rdb:/# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root       127M   96M   25M  80% /

devtmpfs        915M  4.0K  915M   1% /dev

tmpfs           973M  212K  972M   1% /var/volatile

tmpfs           973M  145M  828M  15% /media/ram

root@t1040rdb:/#

Regards,

Chandra

0 Kudos
4,357 Views
addiyi
NXP Employee
NXP Employee

Rootfs is a type of Ramfs and it should grow dynamically as needed.


Adrian

0 Kudos
4,357 Views
chandrashekhar
Contributor III


Hi Adrian,

I saw Rootfs grows upto some extend. But after that when I added little bigger file (around 35 MB size) there is an error while loading the linux kernel. Below is the part of linux boot messages,

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00

sd 0:0:0:0: [sda] No Caching mode page present

sd 0:0:0:0: [sda] Assuming drive cache: write through

attempt to access beyond end of device
ram0: rw=0, want=263318, limit=262144
attempt to access beyond end of device
ram0: rw=0, want=263302, limit=262144
grep: error while loading shared libsd 0:0:0:0: [sda] No Caching mode page present
raries: /lib/libm.so.6: cannot rsd 0:0:0:0: [sda] Assuming drive cache: write through
ead file data: Input/output erro sda:
r
attempt to access beyond end of device
ram0: rw=0, want=265574, limit=262144
attempt to access beyond end of device
ram0: rw=0, want=265574, limit=262144
/etc/init.d/rc: line 52: /etc/rcattempt to access beyond end of device
S.d/S01keymap.sh: Input/output eram0: rw=0, want=263302, limit=262144
rror
attempt to access beyond end of device
grep: error while loading sharedram0: rw=0, want=269590, limit=262144
libraries: /lib/libm.so.6: cannattempt to access beyond end of device
ot read file data: Input/output ram0: rw=0, want=269590, limit=262144
error
attempt to access beyond end of device
ram0: rw=0, want=269590, limit=262144
Starting Bootlog daemon: attempt to access beyond end of device
ram0: rw=0, want=263302, limit=262144
start-stop-daemonattempt to access beyond end of device
: error while loading shared libram0: rw=0, want=265576, limit=262144
raries: /lib/libm.so.6: cannot rattempt to access beyond end of device
ead file data: Input/output erroram0: rw=0, want=265576, limit=262144
r
bootlogd.
sd 0:0:0:0: [sda] No Caching mode page present
mount: you must specify the filesd 0:0:0:0: [sda] Assuming drive cache: write through
system type
sd 0:0:0:0: [sda] Attached SCSI removable disk
attempt to access beyond end of device
ram0: rw=0, want=263302, limit=262144
sed: error while loading shared libattempt to access beyond end of device
raries: /lib/libm.so.6: cannot rram0: rw=0, want=265122, limit=262144
ead file data: Input/output erroattempt to access beyond end of device
r
ram0: rw=0, want=265106, limit=262144
ls: error while loading shared libattempt to access beyond end of device
raries: /lib/libcap.so.2: cannotram0: rw=0, want=263302, limit=262144
read file data: Input/output erattempt to access beyond end of device
ror
grep: error while loading sram0: rw=0, want=263302, limit=262144
hared libraries: /lib/libm.so.6:attempt to access beyond end of device
cannot read file data: Input/ouram0: rw=0, want=265220, limit=262144
tput error
Configuring network attempt to access beyond end of device
interfaces... ifup: error while ram0: rw=0, want=265204, limit=262144
loading shared libraries: /lib/lattempt to access beyond end of device
ibm.so.6: cannot read file data:ram0: rw=0, want=263302, limit=262144
Input/output error
/sbin/sysctattempt to access beyond end of device
l: error while loading shared liram0: rw=0, want=263302, limit=262144
braries: /lib/libproc-3.2.8.so: attempt to access beyond end of device
cannot read file data: Input/outram0: rw=0, want=265106, limit=262144
put error
INIT: Entering runlevel: 5
attempt to access beyond end of device
ram0: rw=0, want=263302, limit=262144
awk: error while loading shared libattempt to access beyond end of device
raries: /lib/libm.so.6: cannot rram0: rw=0, want=266010, limit=262144
ead file data: Input/output erroattempt to access beyond end of device
r
Starting Dropbear SSH server:ram0: rw=0, want=265994, limit=262144
attempt to access beyond end of device
ram0: rw=0, want=265994, limit=262144
/etc/rc5.d/S10dropbear: line 65:attempt to access beyond end of device
/usr/sbin/dropbearkey: Input/ouram0: rw=0, want=263302, limit=262144
tput error
attempt to access beyond end of device
hwclock: error while loading sharam0: rw=0, want=263302, limit=262144
red libraries: /lib/libm.so.6: cattempt to access beyond end of device
annot read file data: Input/outpram0: rw=0, want=263302, limit=262144
ut error
Starting network benchattempt to access beyond end of device
mark server: netserver.
Startinram0: rw=0, want=263302, limit=262144
g system log daemon...grep: erroattempt to access beyond end of device
r while loading shared librariesram0: rw=0, want=263302, limit=262144
: /lib/libm.so.6: cannot read fiattempt to access beyond end of device
le data: Input/output error
staram0: rw=0, want=263302, limit=262144
rt-stop-daemon: error while loading shared libraries: /lib/libm.so.6: cannot read file data: Input/output error
127
Starting kernel log daemon...start-stop-daemon: error while loading shared libraries: /lib/libm.so.6: cannot read file data: Input/output error
127
Stopping Bootlog daemon: start-stop-daemon: error while loading shared libraries: /lib/libm.so.6: cannot read file data: Input/output error
bootlogd.

Poky 9.0 (Yocto Project 1.4 Reference Distro) 1.4.1  ttyS0

INIT: Id "2" respawning too fast: disabled for 5 minutes
INIT: Id "2" respawning too fast: disabled for 5 minutes

Do you have any suggestion to resolve this issue?

Regards,

Chandra

0 Kudos
4,357 Views
scottwood
NXP Employee
NXP Employee

While initramfs grows automatically, these error messages indicate you're using initrd instead (which is what Yocto currently produces).  You'll need to use the ramdisk_size kernel parameter to make the ramdisk bigger.  E.g. for a 300 MiB ramdisk, use ramdisk_size=307200

4,357 Views
caryo_brien
Contributor III

I think your setup is somehow different from ours.  We are booting either from

jffs2 or ext2 (when using qemu).  The initial size was 8MB (see

meta-fsl-networking/images/fsl-image-minimal.bb), which we increased

to 80MB.  I don't know how the 127M size is selected in your system

If this is a ramdisk it might be limited somewhere else, i.e. a kernel command

line parameter, or available memory perhaps.

-- cary

0 Kudos