[U-Boot] Can u-boot access Linux's mtd partition?

Joe Culler joe.culler at gmail.com
Tue Mar 2 16:33:03 CET 2010


Wolfgang Denk wrote:
Dear Joe Culler,
>
Dear Wolfgang,

In message <67a3f13e1003010713y432d5ee2y17a7962b15e89c9a at mail.gmail.com>
you wrote:
> >
> > If I've already created some configuration files such as mac address
> > in mtd2 partition.
> > For example:
> > 0x00000000-0x00040000 : "Bootloader"
> > 0x00040000-0x02000000 : "User config"
> >
> > Does u-boot can access mtd2 partition and read the mac address from
> > the configure file?
>
> Yes, it can, but you're implementing this the wrong way round.
> Normally the boot loader configured low level things like the MAC
> address, and then passes this information on to Linux.
>
Thanks for the reply. Let me explain why I do this way in details.
I work for the system integration company, the board I have is no
eeprom, that means I have to burn the mac address before shipping the
product. So the following steps are what I do before shipping:

1. First, I set default CONFIG_ETHADDR(for example, 02:80:ad:20:31:e8)
   in u-boot, then use flash writer to burn the flash on each board.
2. I have a program for burning mac address on Linux.
   After booting linux kernel, my program can burn the mac address.
   Reboot the system if burning the mac address successfully.
3. Since the mac address is already stored in mtd2, for example.
   I want u-boot to detect the correct mac address I burned in mtd2
   partition rather than the default setting 02:80:ad:20:31:e8.

Is it the correct way I do or do you have any better idea? Thank you.

> If so, would anyone tell me how to do or what similar code can I refer
> > to in u-boot? Thanks.
>
> See for example the "mtdparts" command.
>
In my example, would you like to tell me how to use mtdparts command to
access mtd2 partition and read the file where the mac address stored?
Thanks again! I'm still don't know how to use mtdparts after reading
the doc :(

> If not, can u-boot read the mac address from the eeprom instead of set
> > it manually?
>
> You can implement anything- it's softwrae, and thus extremely
> flexible. But don't expect to find any ready-to-use code for your own
> proprietary data formats. You will have to adapt this yourself.
>
> Best regards,
>
> Wolfgang Denk
>
Best regards,
Joe.


More information about the U-Boot mailing list