logo

Could not compile stylesheet for simplistic. Using last compiled stylesheet.
Question
Morlans
Morlans
Offline
0
Hello,

First at all, I'm not sure if this question should be place in any of the existing subsections, if it should be I apologize by my mistake.

I'm quite newbie using yocto, u-boot and linux kernel and I'm doing some test with one of your boards. I have an IGEP COM AQUILA AM335x board (128Mb NAND) and my target is to be able to modify u-boot environment variables from linux user space. I've set up the system with two partitions with the available linux in order to have a backup if there is any problems. Using U-boot commands I've achieve the target of switch partitions, so the next step I tried to do is doing the same from linux.

Looking for internet I've found that exists u-boot-fw-utils (fw_printenv/setenv) to do this kind of task. Each time I've tried to use fw_printenv I've always receive the same message (see below) and then print the default environment:

Warning: Bad CRC, using default environment


However, my efforts I didn't achieve to do it, so If anyone can help me I'll be grateful.
I'll put my configuration below to let you to understand my situation:

I'm working with a linux (linux-4.1.y-am335x git://git.isee.biz/pub/scm/linux-omap-2.6.git), u-boot (v2015.07) and my own meta to add some firmware.

Uboot configuration -> am335_igep0033.h:
...

/* NAND support */
#define CONFIG_NAND_OMAP_ELM
#define CONFIG_SYS_NAND_ONFI_DETECTION	1
#define CONFIG_SYS_ENV_SECT_SIZE	(128 

Linux dts:[b]

		

                /* MTD partition table */
		partition@0 {
			label = "SPL";
			reg = ;
		};

		partition@1 {
			label = "U-boot";
			reg = ;
		};

		partition@2 {
			label = "U-Boot Env";
			reg = ;
		};

		partition@3 {
			label = "FileSystemI";
			reg = ;
		};

		partition@4 {
			label = "FileSystemII";
			reg = ;
		};	



[b]Linux commands


1- cat /proc/mtd

dev:    size   erasesize  name
mtd0: 00080000 00020000 "SPL"
mtd1: 00100000 00020000 "U-boot"
mtd2: 00020000 00020000 "U-Boot Env"
mtd3: 03f20000 00020000 "FileSystemI"
mtd4: 03f20000 00020000 "FileSystemII"


1- cat /proc/partitions

   
   1        0      16384 ram0
   1        1      16384 ram1
   1        2      16384 ram2
   1        3      16384 ram3
   1        4      16384 ram4
   1        5      16384 ram5
   1        6      16384 ram6
   1        7      16384 ram7
   1        8      16384 ram8
   1        9      16384 ram9
   1       10      16384 ram10
   1       11      16384 ram11
   1       12      16384 ram12
   1       13      16384 ram13
   1       14      16384 ram14
   1       15      16384 ram15
  31        0        512 mtdblock0
  31        1       1024 mtdblock1
  31        2        128 mtdblock2
  31        3      64640 mtdblock3
  31        4      64640 mtdblock4



3- fw_env.config

  
# MTD device name       Device offset   Env. size         Flash sector size           N. Sectors
...
# NAND example
/dev/mtd2                          0x0000          0x20000         0x20000                        1


At this point if I do hexdump -C /dev/mtd2 I can read the crc and the whole environment modified by me but it not matches with the crc calculated at fw_printenv.
I've attached the strace of fw_printenv but I'm not be able to see where is the problem because it can read /dv/mtd2, the problem is the two crcs are different.

I don't have any clue which it can be the problem or problems so If someone can help I'll appreciate.

Thanks for your time and help.

Accepted Answer

Friday, April 28 2017, 09:26 AM - #permalink
0
Hi Morlans,

I have an IGEP COM AQUILA AM335x board (128Mb NAND) and my target is to be able to modify u-boot environment variables from linux user space. I've set up the system with two partitions with the available linux in order to have a backup if there is any problems. Using U-boot commands I've achieve the target of switch partitions, so the next step I tried to do is doing the same from linux.

I suggest you to create or edit an uEnv.txt file from kernel userspace in order to manage u-boot environment variables. igep_qa tool uses it for a similar purpose.

Hope it helps.

Cheers!
The reply is currently minimized Show
Responses (6)
  • Accepted Answer

    Morlans
    Morlans
    Offline
    Tuesday, May 02 2017, 05:45 PM - #permalink
    0
    Thanks for your replay,

    I have another doubt about uEnv.txt. the link you gave me on your answer talks about loading uEnv.txt from sd card. Is it possible to load uEnv.txt form a Nand memory partition (mtd)?

    Thanks for your replay, I'll keep working on it.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, May 02 2017, 06:08 PM - #permalink
    0
    Hi Morlans,

    I have another doubt about uEnv.txt. the link you gave me on your answer talks about loading uEnv.txt from sd card. Is it possible to load uEnv.txt form a Nand memory partition (mtd)?

    Yes, I suggest you create a new UBIFS partition and modify "loadbootenv" variable to achive it.

    Cheers!
    The reply is currently minimized Show
  • Accepted Answer

    Morlans
    Morlans
    Offline
    Monday, May 08 2017, 03:27 PM - #permalink
    0
    pau pajuelo wrote:

    Hi Morlans,

    I have another doubt about uEnv.txt. the link you gave me on your answer talks about loading uEnv.txt from sd card. Is it possible to load uEnv.txt form a Nand memory partition (mtd)?

    Yes, I suggest you create a new UBIFS partition and modify "loadbootenv" variable to achive it.

    Cheers!


    Hello, thanks for your answer.

    I'm doing what you suggested me but I'm dealing with a problem related how many LEBs and PEBs are available. I've read an article which it says that UBIFS shouldn't be used on small partitions because of overhead generated. In my case uEnv.txt partiton is smaller than 1MB so, is it a good idea to use UBIFS? What option should I use If it is not?

    Thanks for your replay
    The reply is currently minimized Show
  • Accepted Answer

    Monday, May 08 2017, 04:42 PM - #permalink
    0
    Hi Morlans,

    I'm doing what you suggested me but I'm dealing with a problem related how many LEBs and PEBs are available. I've read an article which it says that UBIFS shouldn't be used on small partitions because of overhead generated. In my case uEnv.txt partiton is smaller than 1MB so, is it a good idea to use UBIFS? What option should I use If it is not?

    jffs2 could be an alternative too.

    Cheers!
    The reply is currently minimized Show
  • Accepted Answer

    Morlans
    Morlans
    Offline
    Wednesday, May 17 2017, 02:01 PM - #permalink
    0
    Hi Pau,

    Finally I've achieve to modify my environment variables from linux space using a uEnv.txt file which is stored in a ubifs partition.

    Thanks for your suggestion and your time,

    Cheers!
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, May 18 2017, 09:19 AM - #permalink
    0
    Hi Morlans,

    Please, mark the thread as solved to close it

    Cheers!
    The reply is currently minimized Show
Your Reply

SUPPORT


This email address is being protected from spambots. You need JavaScript enabled to view it.
This email address is being protected from spambots. You need JavaScript enabled to view it.
IGEP Community Wiki
IGEP Community Forum
IGEP Community Online Chat