[U-Boot] Environment structure.

Hello All! I develop some "upgrade" tool based on the U-Boot booted from SD card. I want to boot from SD card, and execute some simple script which is stored in bootcmd environment variable: "echo Hello! ; mmcinit ; sleep 10 ; reset; " etc... So I need to generate some environment file. I find source from tools/env very useful (I try to get variables from correct file I already have), but I can't find any description of environment file (or flash partition) at all (which I need to write tool for generating environment file). Can someone explain me the structure of the file, please. Something like: 0-4 - CRC 5-... - (Environment)\0(Environment)\0... ... Environment End Mark... and so on.
Or tell me in what file should I see from U-Boot source.
And is there any difference between content of OneNAND flash environment-partition and file on SD card?
Thank you.

Hi Tuma,
Hello All!
Hiya.
I develop some "upgrade" tool based on the U-Boot booted from SD card. I want to boot from SD card, and execute some simple script which is stored in bootcmd environment variable: "echo Hello! ; mmcinit ; sleep 10 ; reset; " etc... So I need to generate some environment file.
Sorry, but I do not understand why you need to generate an environment image if you only eant to run some scripts. Can we please step back again and talk about what you want to achieve? Pretty likely there is a different and cleaner solution to your problem.
I find source from tools/env very useful (I try to get variables from correct file I already have), but I can't find any description of environment file (or flash partition) at all (which I need to write tool for generating environment file). Can someone explain me the structure of the file, please. Something like: 0-4 - CRC
Well the problem is that environment can be in a different format, depending on configuration options. If for example you enable redundand environments, you will have another byte after the crc signalling which of the two copies is the active one.
5-... - (Environment)\0(Environment)\0... ... Environment End Mark... and so on.
Or tell me in what file should I see from U-Boot source.
A good start would be to read /include/environment.h - but only after you are really sure that you want to generate an environment after all :)
And is there any difference between content of OneNAND flash environment-partition and file on SD card?
I can parse the sentence syntactically, but I have no clue what you are asking here...
Cheers Detlev

Hello, all! Detlev, thank for oyur reply. So I don't need environment file parser any more.
But now I have new question - how can I display a Bitmap picture on the board's LCD? I know there is the "bmp" command, but how should I configure and build U-Boot to have this command in prompt? My board is OMAP3EVM.
Thank you.
On Thursday 30 July 2009 19:29:27 you wrote:
Hi Tuma,
Hello All!
Hiya.
I develop some "upgrade" tool based on the U-Boot booted from SD card. I want to boot from SD card, and execute some simple script which is stored in bootcmd environment variable: "echo Hello! ; mmcinit ; sleep 10 ; reset; " etc... So I need to generate some environment file.
Sorry, but I do not understand why you need to generate an environment image if you only eant to run some scripts. Can we please step back again and talk about what you want to achieve? Pretty likely there is a different and cleaner solution to your problem.
I find source from tools/env very useful (I try to get variables from correct file I already have), but I can't find any description of environment file (or flash partition) at all (which I need to write tool for generating environment file). Can someone explain me the structure of the file, please. Something like: 0-4 - CRC
Well the problem is that environment can be in a different format, depending on configuration options. If for example you enable redundand environments, you will have another byte after the crc signalling which of the two copies is the active one.
5-... - (Environment)\0(Environment)\0... ... Environment End Mark... and so on.
Or tell me in what file should I see from U-Boot source.
A good start would be to read /include/environment.h - but only after you are really sure that you want to generate an environment after all
:) :
And is there any difference between content of OneNAND flash environment-partition and file on SD card?
I can parse the sentence syntactically, but I have no clue what you are asking here...
Cheers Detlev

Hi Tuma,
But now I have new question - how can I display a Bitmap picture on the board's LCD? I know there is the "bmp" command, but how should I configure and build U-Boot to have this command in prompt? My board is OMAP3EVM.
Well for the bmp command to work, an implementation for the LCD part needs to be there. Checking the configs for supported OMAP boards, not one defines CONFIG_LCD:
$ grep CONFIG_LCD `grep -l OMAP include/configs/*` | wc -l 0
As an example the MPC823 LCD controller is supported:
$ grep CONFIG_LCD `grep -l MPC823 include/configs/*` | wc -l 25
I fear that you will need to implement support for the LCD controller yourself.
Cheers Detlev

Hello, Detlev! Thanks for your reply. While I've been waiting for reply, I've found some information from Internet and source code. I tryed to configure current omap3evm config file, but I get errors during compilation. So I know there is no LCD support for OMAP3evm now. And now I think about the way I could implement LCD support for my board.
Thank you!
On Wednesday 05 August 2009 18:31:14 Detlev Zundel wrote:
Hi Tuma,
But now I have new question - how can I display a Bitmap picture on the board's LCD? I know there is the "bmp" command, but how should I configure and build U-Boot to have this command in prompt? My board is OMAP3EVM.
Well for the bmp command to work, an implementation for the LCD part needs to be there. Checking the configs for supported OMAP boards, not one defines CONFIG_LCD:
$ grep CONFIG_LCD `grep -l OMAP include/configs/*` | wc -l 0
As an example the MPC823 LCD controller is supported:
$ grep CONFIG_LCD `grep -l MPC823 include/configs/*` | wc -l 25
I fear that you will need to implement support for the LCD controller yourself.
Cheers Detlev

Hi Tuma,
While I've been waiting for reply, I've found some information from Internet and source code. I tryed to configure current omap3evm config file, but I get errors during compilation. So I know there is no LCD support for OMAP3evm now.
This can be changed ;)
And now I think about the way I could implement LCD support for my board.
Good. Let me give you one piece of advice though - post your efforts early and often so that people here in the ML with experience can help you not going down the wrong route. Also someone else may jump in and help out ;)
Cheers Detlev

Hi, All! Thank you, Detlev!
Now I have a question. I have LCD drivers from TI for OMAP3 evm board. I need to include this files to my current u-boot. I have .h and .c files with some functional I need. I want to call some functions implemented in this files from main_loop (). I put .h files in the "include" directory, adn .c files to the "drivers" directory. Then I include appropriate .h file in main.c, compile and get error: "/root/GS/Taimen/U-Boot-Upgrader/common/main.c:343: undefined reference to `enable_lcd_power'".
What do I do wrong? How new files should be added to the project?
Thank you!
On Thursday 06 August 2009 19:25:11 you wrote:
Hi Tuma,
While I've been waiting for reply, I've found some information from Internet and source code. I tryed to configure current omap3evm config file, but I get errors during compilation. So I know there is no LCD support for OMAP3evm now.
This can be changed ;)
And now I think about the way I could implement LCD support for my board.
Good. Let me give you one piece of advice though - post your efforts early and often so that people here in the ML with experience can help you not going down the wrong route. Also someone else may jump in and help out ;)
Cheers Detlev

Dear Tuma,
In message 200908131326.20857.chernigovskiy@spb.gs.ru you wrote:
I have LCD drivers from TI for OMAP3 evm board. I need to include this files to my current u-boot. I have .h and .c files with some functional I need. I want to call some functions implemented in this files from main_loop (). I
You definitely do NOT want to do that. the main_loop is the command interpreter. Don't mess with that code.
put .h files in the "include" directory, adn .c files to the "drivers" directory. Then I include appropriate .h file in main.c, compile and get error: "/root/GS/Taimen/U-Boot-Upgrader/common/main.c:343: undefined reference to `enable_lcd_power'".
What do I do wrong? How new files should be added to the project?
You also have to make sure these files get linked, so check the parts of the Makefiles that include objects into the respective libraries.
Best regards,
Wolfgang Denk
participants (3)
-
Detlev Zundel
-
Tuma
-
Wolfgang Denk