Le lundi 16 mars 2015 à 09:12 +0100, Hans de Goede a écrit :
> Hi,
> 
> On 15-03-15 22:38, Paul Kocialkowski wrote:
> > As far as I know, there is currently no mechanism in place to give each
> > device a unique serial number, that would be shown in
> > e.g. /proc/cpuinfo. This can seem not very useful, but it would be
> > nice to have that for USB gadget drivers that make use of it (e.g. ADB on
> > Android, fastboot, etc). This would allow having multiple sunxi devices
> > connected at the same time.
> >
> > Normally, the serial number has to be figured out by the bootloader and
> > passed to the kernel through ATAGs. In U-Boot, it is defined using
> > get_board_serial, that is not yet implemented on sunxi.
> >
> > I'm interested in figuring out the best way to do this. As far as I can
> > see, Allwinner SoCs have some e-fuses, known as SID (Security ID):
> > http://linux-sunxi.org/SID_Register_Guide for which Oliver has written a
> > mainline Linux driver. Those should have device-specific values, except
> > when they are set to 0.
> >
> > Do you have any better idea to do this, or is there some reference that
> > I am missing?
> 
> AFAIK the only way to do a serial number on sunxi devices is using the SID,
> note that Oliver's driver will only work on A10, A13 and A20, with the
> A31, A23 and others the SID is burned into the pmic rather then the SoC
> itself, but it should be easy to implement get_board_serial() in u-boot
> as we already have a sunxi_get_sid() helper to do that in a SoC
> independent way (this is currently used to set the ethernet MAC address).
> 
> Note that sunxi_get_sid() can fail, so you need to error check it,
> and currently it will happily return an all 0 SID, you should probably
> make it return an error in that case, as that check really belongs
> inside sunxi_get_sid().

Why exactly is it a problem if the SID is 0 here? I don't see a big
difference between providing a zero serial and not providing any serial
at all (in any case, Linux will keep it at 0 when none is provided).

U-Boot doesn't check the return code of setup_serial_tag either and
isn't designed to not include the tag if it somewhat failed to grab the
serial number.

Hence my point is, let's not bother whether it's zero or not: it will
just improve the situation on the vast majority of devices that have (at
least) the first 4 32bit words of the SID populated and leave others
with a zero serial, as it was until now.

-- 
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.

Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to