Creating and accessing files in rootfs

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Creating and accessing files in rootfs

2,780 次查看
narreddisivapra
Contributor II

Hello,

            can anyone suggest to create a file in rootfs which is present in flash and reading same file from rootfs.? Actually I am using MPC8323e-rdb board for application development and I loaded rootfs and kernel(output of ltib) into flash with the help of reference document provided by nxp. Now, I am trying to create a file through a c-code in rootfs and trying to access same file using c-code after rebooting the board. But, the created file is not existing after rebooting the board. What might be the reason.? Please, help me in understanding this scenario.

Thanks and Regards,

Siva Prakash Reddy N

标记 (2)
0 项奖励
回复
4 回复数

1,835 次查看
narreddisivapra
Contributor II

Hello,

            Please respond to my mail as soon as possible.

Thanks and Regards,

Siva Prakash Reddy N

0 项奖励
回复

1,835 次查看
narreddisivapra
Contributor II

Thanks for your valuable response.

I loaded images into flash and ran the command "imls" but it is not executing root file system but it does kernel image.

0 项奖励
回复

1,835 次查看
Pavel
NXP Employee
NXP Employee

It looks like that you use ext2 RAMDISK image of rootfs. Therefore the MPC8323 cannot change RAMDISK image in the Flash.

Try to use JFFS2 file system on your board.

You can also add required file to the roofs on your PC and create new ext2 RAMDISK image of the rootfs.

 

Use the following command sequence for adding file to RAM disk image.

  1. rename your RAM disk image to rootfs.ext2.gz.uboot
  2. sudo apt-get install u-boot-tools

Following are the steps for adding files into rootfilesystem:

 

  1. dd if=rootfs.ext2.gz.uboot of=rootfs.ext2.gz bs=64 skip=1

 

  1. gunzip rootfs.ext2.gz

 

  1. mkdir /mnt/iso_1

 

  1. sudo mount -oloop rootfs.ext2 /mnt/iso_1

 

  1. Now, one can copy files into appropriate location under “./mnt/iso_1” directory.

 

  1. sudo umount /mnt/iso_1

 

  1. gzip -9 rootfs.ext2

 

  1. mkimage -A ppc -O linux -T ramdisk -C gzip -n 'rootfs.ext2.gz.uboot' -d rootfs.ext2.gz rootfs.ext2.gz.uboot


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,835 次查看
narreddisivapra
Contributor II

Hello,

         Thanks for your valuable response.

         I created jffs2 formatted rootfs and tried to load into flash, but when I ran imls command, it is not showing the rootfs image in flash. my requirement is than I want to store my application status variables in a file (which should be created at run time) and save it in rootfs and it should be retain in rootfs even after reboot. Please, help me in understanding of accessing files in rootfs.

Thanks and Regards,

Siva Prakash Reddy N

0 项奖励
回复