Why /dev/mem has null size?

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Dec 14 13:13:33 EST 2020


Hello Antoine,

On 14.12.20 18:51, DEMIRDJIAN, Antoine wrote:
> Dear all,
> 
> I'm trying to "addpart" to /dev/mem in order to copy my raw boot image inside.

The normal usage is to let barebox worry about memory allocation:

  bootm /image and go /image both memory map /image for you.

If you absolutely want to hardcode the load address, use the memcpy
command: https://www.barebox.org/doc/latest/commands/mem/memcpy.html

> But I noticed that /dev/mem doesn't really exists :
> 
> From devinfo :
> 
>    `-- mem1
>       `-- 0x00000000-0xffffffffffffffff (   0 Bytes): /dev/mem
> 
> And more specifically :
> 
> barebox at MyBoard:/ devinfo mem1
> Resources:
>   num: 0
>   name: mem
>   start: 0x00000000
>   size: 0x00000000
> Driver: mem
> Bus: platform
> 
> As a consequence, my addpart fails with "partition end is beyond device".

I don't think addpart is meant to operate on the mem device. /dev/mem
is usually used along with memcpy, md, mw, where /dev/mem is the default
device they operate on.

> Do you have any idea why my /dev/mem size is 0x0 ?

/dev/mem always has size 0 in barebox, because its size makes
it a bit special. Many operations don't make sense for it as well,
so having a zero size makes them fail.

Cheers,
Ahmad

> 
> Thanks,
> 
> --
> Antoine D
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list