SD card settings gone after reboot of LS1021A-IoT

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

SD card settings gone after reboot of LS1021A-IoT

Jump to solution
1,518 Views
masranipiyush
Contributor II

Hi,

I am a newbie to LS1021A-IoT and am exploring it for a project. I got the board up and running and tried to add my agent to collect stats on the board. However, on reboot of the board, none of the changes are available on the card. Even if I create a directory in the filesystem, it is not present after reboot. Am I missing some setting?

Thanks,

Piyush

0 Kudos
1 Solution
1,092 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Piyush,

You are using RAM disk filesystem, you copied uImage, dtb and filesystem to RAM, then boot rootfs filesystem from RAM, so when the system reset, the modification is lost.

Please use the procedure to boot filesystem from SD, which I provided previously.

1. Please add the following line after IMAGE_INSTALL variable definition  in the recipe meta-fsl-networking/images/fsl-image-core.bb.

IMAGE_FSTYPES += "tar.gz"

Then run "bitbake fsl-image-core" to generate fsl-image-core-<platform>.tar.gz file in build_<platform>_release/tmp/deploy/images/<platform>/ folder.

2. Create another partition with "fdisk /dev/sdb" command and format this partition with "mkfs.ext2 /dev/sdb2".

On your PC, mount the second partition of SD card, and copy fsl-image-core-<platform>.tar.gz to this partition and extract it.

# cp fsl-image-core-<platform>.tar.gz .

# tar -zxvf fsl-image-core-<platform>.tar.gz

# rm fsl-image-core-<platform>.tar.gz

Copy uImage and dtb file to /boot folder.

3. Plug in the SD card to the target board and power on.

4. Set the environment in uboot for SD boot.

# setenv bootcmd 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=5 console=ttyS0,115200;mmcinfo;ext2load mmc 0:2 0x83000000 /boot/uImage-ls1021aiot.bin;ext2load mmc 0:2 0x83800000 /boot/uImage-ls1021aiot.dtb;bootm 0x83000000 - 0x83800000'

# save

# boot

If your problem remains, please provide the console log and u-boot environment (with pri command) again.


Have a great day,
Yiping

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

View solution in original post

0 Kudos
7 Replies
1,092 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Piyush Masrani,

What kind of filesystem do you use to boot up the system? Do you boot the file system from SD card?

Please refer to the following procedure to deploy the system to boot Kernel and filesystem from SD card.

1. Use the mkfs.ext2 command to create the filesystems.

# mkfs.ext2 /dev/sdb2

2. Copy the file system to SD card by extracting the rootfs.tar.gz, remove the tarball after extracting rootfs.

# cp rootfs.tar.gz .

# tar -zxvf rootfs.tar.gz

# rm rootfs.tar.gz

Copy uImage and dtb file to /boot folder.

3. Plug in the SD card to the target board and power on.

4. Set the environment in uboot for SD boot.

# setenv bootfile uImage

# setenv fdtfile uImage.dtb

# setenv bootcmd 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=5 console=$consoledev,$baudrate;mmcinfo;ext2load mmc 0:2 $loadaddr /boot/$bootfile;ext2load mmc 0:2 $fdtaddr /boot/$fdtfile;bootm $loadaddr - $fdtaddr'

# boot

In addition, would you please provide your console log to help me to get your current status clearly?


Have a great day,
Yiping

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

0 Kudos
1,092 Views
masranipiyush
Contributor II

Hi Yiping,

Thanks for the reply!

I do boot the system from SD card. I tried with 2 SD cards:

1) The first one which was shipped with the board has fsl-image-rds-iot-ls1021aiot.ext2.gz.u-boot pre-installed on the card. It boots fine and I am able to login to the board via a serial connection without issues. While the SD card is in the board, I am able to add files to the system and create directories. However, when I reboot the board. All the data is lost. Logs are available at: https://community.freescale.com/servlet/JiveServlet/downloadBody/285430-102-1-215300/message-565929-...

2) I got another SD card of the same configuration and followed the steps given at: http://cache.freescale.com/files/soft_dev_tools/doc/support_info/LS1021A-SDK-V1.1-ARM-SOURCE_RMF.txt . I was able to get the login prompt, but once I reboot the gateway, all the files loaded using tftp are lost from the card.

Hence, i believe the gateway is not able to write to the SD card, but is loading everything in the cache for both the cards. Is my understanding correct? Hence, I am looking for some configuration change on the gateway to be able to write to SD card.

I tried following the procedure you gave in your reply, but the gateway is not able to boot from the SD card. I don't get the uboot console at all.

Any help will be greatly appreciated.

Thanks,

Piyush

0 Kudos
1,092 Views
sharper
Contributor III

Hello Piyush,

It looks to me from your logs that your rootfs is running as a ramdisk:

[    0.000000] Kernel command line: root=/dev/ram0 rw rootwait console=ttyS0,115200

Furthermore, the instructions you link to indicate that you are generating a ramdisk as the output of your Yocto build:

3. The built images will be in the following directory

  <yocto_install_patch>/build_<machine>_release/tmp/deploy/images/<machine>/

  fsl-image-<core/rds>-<machine>.ext2.gz.u-boot - ramdisk image that can be loaded with U-Boot

  fsl-image-<core/rds>-<machine>.ext2.gz - gzipped ramdisk image

Can you stop at the u-boot prompt and post the output of "printenv"?

I do not have an LS1021A-IOT board but I do have an LS1021A-TWR board that I can run a persistent SD filesystem from.

I suspect that they should be very similar.

0 Kudos
1,092 Views
masranipiyush
Contributor II

Yes Stephen, it is a ramdisk image. Does it cause any issues? How do I make sure the boot happens from a persistent SD?

The output of printenv is:

===================================================================================

baudrate=115200

bootargs=root=/dev/ram0 rw rootwait console=ttyS0,115200

bootcmd=run mmcboot

bootdelay=3

bootlinux=tftp 82000000 ls1021a-iot/uImage.ls1;tftp 8f000000 ls1021a-iot/ls1021a-iot.dtb;tftp 88000000 ls1021a-iot/ramdisk.u-boot;bootm 0x82000000 0x88000000 0x8f000000

consoledev=ttyS0

eth1addr=00:e0:0c:bc:e5:61

eth2addr=00:e0:0c:bc:e5:62

ethact=eTSEC2

ethaddr=00:e0:0c:bc:e5:60

ethprime=eTSEC2

fdt_high=0xcfffffff

filesize=61db48d

hwconfig=fsl_ddr:ctlr_intlv=null,bank_intlv=null

initrd_high=0xcfffffff

ipaddr=192.168.1.100

loadaddr=0x82000000

mmcargs=setenv bootargs root=/dev/ram0 rw rootwait console=$consoledev,$baudrate $othbootargs

mmcboot=run mmcargs; mmc rescan; fatload mmc 0:1 0x83000000 uImage-ls1021aiot.bin; fatload mmc 0:1 0x83800000 uImage-ls1021aiot.dtb; fatload mmc 0:1 0x8f000000 fsl-image-rds-iot-ls1021aiot.ext2.gz.u-boot;bootm 0x83000000 0x8f000000 0x83800000

scsidevs=0

serverip=192.168.1.1

stderr=serial

stdin=serial

stdout=serial

Environment size: 1010/8188 bytes

===================================================================================

Thanks,

Piyush

0 Kudos
1,093 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Piyush,

You are using RAM disk filesystem, you copied uImage, dtb and filesystem to RAM, then boot rootfs filesystem from RAM, so when the system reset, the modification is lost.

Please use the procedure to boot filesystem from SD, which I provided previously.

1. Please add the following line after IMAGE_INSTALL variable definition  in the recipe meta-fsl-networking/images/fsl-image-core.bb.

IMAGE_FSTYPES += "tar.gz"

Then run "bitbake fsl-image-core" to generate fsl-image-core-<platform>.tar.gz file in build_<platform>_release/tmp/deploy/images/<platform>/ folder.

2. Create another partition with "fdisk /dev/sdb" command and format this partition with "mkfs.ext2 /dev/sdb2".

On your PC, mount the second partition of SD card, and copy fsl-image-core-<platform>.tar.gz to this partition and extract it.

# cp fsl-image-core-<platform>.tar.gz .

# tar -zxvf fsl-image-core-<platform>.tar.gz

# rm fsl-image-core-<platform>.tar.gz

Copy uImage and dtb file to /boot folder.

3. Plug in the SD card to the target board and power on.

4. Set the environment in uboot for SD boot.

# setenv bootcmd 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=5 console=ttyS0,115200;mmcinfo;ext2load mmc 0:2 0x83000000 /boot/uImage-ls1021aiot.bin;ext2load mmc 0:2 0x83800000 /boot/uImage-ls1021aiot.dtb;bootm 0x83000000 - 0x83800000'

# save

# boot

If your problem remains, please provide the console log and u-boot environment (with pri command) again.


Have a great day,
Yiping

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

0 Kudos
1,092 Views
masranipiyush
Contributor II

Thanks Yiping and Stephen! That solved the problem.

0 Kudos
1,092 Views
sharper
Contributor III

It causes issues for your application in the sense that a ramdisk image is not persistent.

http://www.denx.de/wiki/view/DULG/RootFileSystemOnARamdisk

Sometimes this behavior is desirable. Say, for a finished product perhaps. It is useful to be able to simply reboot a board and get a known-good state as a recovery mechanism for any errors.

For starters, it is worth checking that your switch settings are configured to boot from an SD card:

As per the Infocenter: Preparing LS1021AIOT board

Your logs would seem to indicate that you have this correct.

(The alternative being to have u-boot and/or kernel in NOR and load the rootfs from SD)

There is a guide here that may be of some use to you:

Timesys Getting Started Guide for Freescale LS1021A Tower Module Kit | Timesys Embedded Linux

I have attached files that I know to be working with the Tower board booting from an SD card.

You will need to be sure to modify the file names in the directions and variables from the link above to match those of the attached files (or just rename them).

Most of these files came from the prebuilt SDK v1.8 images here:

Linux® SDK for QorIQ Processors v1.8|Freescale

namely, Image: QorIQ SDK v1.8 CORTEXA7 IMAGE yocto

0 Kudos