public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Neil Bryan <nbryan@embebidos.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] U-boot code etiquette
Date: 24 Jan 2005 10:19:15 +0100	[thread overview]
Message-ID: <1106558355.3698.47.camel@daroca> (raw)

Hello group,

I have a problem to solve which effects U-boot environment variable 
storage.  Before I submit changes to core U-boot code, I want to
find out from the group 'what is acceptable code to modify?'.

I am afraid that this description is quite long, but I do not know
how to describe it in very few words.

TARGET DESCRIPTION:
Based on the AT91RM9200 MCU from Atmel with 8kbytes of I2C EEPROM.
For my initial investigation I am using the AT91RM9200DK port of 
U-boot.

PROBLEM:
The board has a limited EEPROM storage area and it has been decided that
U-boot environment variables are to be stored in EEPROM.  

U-boot uses quite a large amount of environment variable space,
in fact the default size for the AM91RM9200DK CFG_ENV_SIZE is 0x2000
(8kbytes). So all my EEPROM disappears to U-boot leaving non for Linux.

I can reduce this by changing ./include/configs/at91rm9200dk.h 
CFG_ENV_SIZE to 0x800 (2kbytes).  U-boot builds, runs and all is well.

BUT, cetain variables such as the board IP address need to be common 
to both Linux and U-boot.  So if the board IP address is changed by the
OS or by Linux, the change needs to be visible to the other.

SOLUTION:
To divide the EEPROM into a psuedo-file structure.  We have data 
structures of varying lengths and types to pack more data into the 
EEPROM.  We need to support a variety of OSes on the board and will 
have several OS-specific data structures.

One data structure would be reserved for U-boot, length 2kBytes,

However, common values such as IP address will be stored in
this psuedo-file structure.

AFFECT ON U-BOOT:
When U-boot reads the environment variables, it needs to check in two
places in EEPROM:

1) The standard U-boot storage of NUL terminated strings, e.g.
bootdelay, bootargs, bootcmd, etc.

2) Our board specific data structure(s) which most likely will be 
baudrate, ethaddr, ethxaddr, ipaddr, serverip.

COMMENTS:

 o I don't want to make board-specific changes in common code areas.
   I can see my proposal affecting cmd_nvedit.c.  This code does
   not have pre-processing for multiple board-types and so 
   architecturaly it feels wrong. 

 o I need to hook into functions getenv() and setenv().  I will read
   a table of constant strings and compare with the environment 
   variable which is being sought and then parse it appropriately.

So, people with lots of U-boot experience, I need your advice.
I don't want to spend lots of time making theses suggested changes
to have it rejected for inclusion into the mainline code.  Will 
it be accepted or is it just too far outside of the way U-boot 
evolves?  Is there a better solution?

Thanks for your time on this.

Regards,

Neil.

             reply	other threads:[~2005-01-24  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-24  9:19 Neil Bryan [this message]
2005-01-24 10:12 ` [U-Boot-Users] U-boot code etiquette Wolfgang Denk
2005-01-24 12:06   ` nbryan at embebidos.com
2005-01-24 15:00     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1106558355.3698.47.camel@daroca \
    --to=nbryan@embebidos.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox