* Expose system Serial Number to userspace.
@ 2012-08-29 15:18 Brad Arnold
2012-08-29 15:50 ` Nicolas Pitre
2012-08-29 16:05 ` Marco Stornelli
0 siblings, 2 replies; 8+ messages in thread
From: Brad Arnold @ 2012-08-29 15:18 UTC (permalink / raw)
To: linux-embedded
Hi,
I'm working on an embedded board which uses u-boot + linux. At
manufacturing time, the device serial number will be programmed into OTP
memory on NAND (probably from within u-boot). We'd like the linux kernel
to make this serial number available to be read from userspace. Is there
an accepted method to do this sort of thing?
One idea I had was to make the serial number available as a device node
(ie: you can simply read the serial number from "/dev/serialnumber"). Then
there's the question of how the kernel learns the serial in the first
place (a kernel boot command like parameter passed from u-boot?).
Does this sound sane, or is there a better way to do something like this?
Thanks,
Brad
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expose system Serial Number to userspace.
2012-08-29 15:18 Expose system Serial Number to userspace Brad Arnold
@ 2012-08-29 15:50 ` Nicolas Pitre
2012-08-29 16:53 ` Brad Arnold
2012-08-29 20:47 ` Brad Arnold
2012-08-29 16:05 ` Marco Stornelli
1 sibling, 2 replies; 8+ messages in thread
From: Nicolas Pitre @ 2012-08-29 15:50 UTC (permalink / raw)
To: Brad Arnold; +Cc: linux-embedded
On Wed, 29 Aug 2012, Brad Arnold wrote:
> Hi,
>
> I'm working on an embedded board which uses u-boot + linux. At
> manufacturing time, the device serial number will be programmed into OTP
> memory on NAND (probably from within u-boot). We'd like the linux kernel
> to make this serial number available to be read from userspace. Is there
> an accepted method to do this sort of thing?
A serial number field is available from /proc/cpuinfo already. you just
have to initialize it through the system_serial_high and
system_serial_low global variables.
Nicolas
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Expose system Serial Number to userspace.
2012-08-29 15:50 ` Nicolas Pitre
@ 2012-08-29 16:53 ` Brad Arnold
2012-08-29 20:47 ` Brad Arnold
1 sibling, 0 replies; 8+ messages in thread
From: Brad Arnold @ 2012-08-29 16:53 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: linux-embedded
That's perfect, thanks!
Brad
-----Original Message-----
From: Nicolas Pitre [mailto:nico@fluxnic.net]
Sent: August-29-12 9:51 AM
To: Brad Arnold
Cc: linux-embedded@vger.kernel.org
Subject: Re: Expose system Serial Number to userspace.
On Wed, 29 Aug 2012, Brad Arnold wrote:
> Hi,
>
> I'm working on an embedded board which uses u-boot + linux. At
> manufacturing time, the device serial number will be programmed into
> OTP memory on NAND (probably from within u-boot). We'd like the linux
> kernel to make this serial number available to be read from userspace.
> Is there an accepted method to do this sort of thing?
A serial number field is available from /proc/cpuinfo already. you just
have to initialize it through the system_serial_high and system_serial_low
global variables.
Nicolas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expose system Serial Number to userspace.
2012-08-29 15:50 ` Nicolas Pitre
2012-08-29 16:53 ` Brad Arnold
@ 2012-08-29 20:47 ` Brad Arnold
2012-08-29 20:52 ` Nicolas Pitre
1 sibling, 1 reply; 8+ messages in thread
From: Brad Arnold @ 2012-08-29 20:47 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: linux-embedded
On Wed, Aug 29, 2012 at 9:50 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
>
> On Wed, 29 Aug 2012, Brad Arnold wrote:
>
> > Hi,
> >
> > I'm working on an embedded board which uses u-boot + linux. At
> > manufacturing time, the device serial number will be programmed into OTP
> > memory on NAND (probably from within u-boot). We'd like the linux kernel
> > to make this serial number available to be read from userspace. Is there
> > an accepted method to do this sort of thing?
>
> A serial number field is available from /proc/cpuinfo already. you just
> have to initialize it through the system_serial_high and
> system_serial_low global variables.
>
>
> Nicolas
Actually, I guess even better than initializing through the two
variables is to pass the serial directly from u-boot using the tag.
Brad
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expose system Serial Number to userspace.
2012-08-29 20:47 ` Brad Arnold
@ 2012-08-29 20:52 ` Nicolas Pitre
0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2012-08-29 20:52 UTC (permalink / raw)
To: Brad Arnold; +Cc: linux-embedded
On Wed, 29 Aug 2012, Brad Arnold wrote:
> On Wed, Aug 29, 2012 at 9:50 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> >
> > On Wed, 29 Aug 2012, Brad Arnold wrote:
> >
> > > Hi,
> > >
> > > I'm working on an embedded board which uses u-boot + linux. At
> > > manufacturing time, the device serial number will be programmed into OTP
> > > memory on NAND (probably from within u-boot). We'd like the linux kernel
> > > to make this serial number available to be read from userspace. Is there
> > > an accepted method to do this sort of thing?
> >
> > A serial number field is available from /proc/cpuinfo already. you just
> > have to initialize it through the system_serial_high and
> > system_serial_low global variables.
> >
> >
> > Nicolas
>
> Actually, I guess even better than initializing through the two
> variables is to pass the serial directly from u-boot using the tag.
Yes, if you are still using ATAGs.
Nicolas
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expose system Serial Number to userspace.
2012-08-29 15:18 Expose system Serial Number to userspace Brad Arnold
2012-08-29 15:50 ` Nicolas Pitre
@ 2012-08-29 16:05 ` Marco Stornelli
2012-08-29 16:57 ` Brad Arnold
1 sibling, 1 reply; 8+ messages in thread
From: Marco Stornelli @ 2012-08-29 16:05 UTC (permalink / raw)
To: Brad Arnold; +Cc: linux-embedded
Il 29/08/2012 17:18, Brad Arnold ha scritto:
> Hi,
>
> I'm working on an embedded board which uses u-boot + linux. At
> manufacturing time, the device serial number will be programmed into OTP
> memory on NAND (probably from within u-boot). We'd like the linux kernel
> to make this serial number available to be read from userspace. Is there
> an accepted method to do this sort of thing?
>
> One idea I had was to make the serial number available as a device node
> (ie: you can simply read the serial number from "/dev/serialnumber"). Then
> there's the question of how the kernel learns the serial in the first
> place (a kernel boot command like parameter passed from u-boot?).
>
> Does this sound sane, or is there a better way to do something like this?
>
> Thanks,
>
> Brad
U-Boot manage a serial number via env variable "serial#". It provides
several tools. You'll find under tools/env applications to read/write
env variable of uboot, so reading from Linux is very simple. You should
use a dedicated little space of flash to store the env variables.
Regards,
Marco
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Expose system Serial Number to userspace.
2012-08-29 16:05 ` Marco Stornelli
@ 2012-08-29 16:57 ` Brad Arnold
2012-08-29 17:07 ` Marco Stornelli
0 siblings, 1 reply; 8+ messages in thread
From: Brad Arnold @ 2012-08-29 16:57 UTC (permalink / raw)
To: Marco Stornelli; +Cc: linux-embedded
That'll help me move along. I'm currently storing the mac and serial in
the u-boot environment, but I was thinking I might want to move those two
to the OTP. But at least having some level of write protection in u-boot
is nice. I wasn't aware that this existed, because it's disabled by
default in the config for Marvell boards.
I'll have to look at that example program futher...
Brad
-----Original Message-----
From: Marco Stornelli [mailto:marco.stornelli@gmail.com]
Sent: August-29-12 10:06 AM
To: Brad Arnold
Cc: linux-embedded@vger.kernel.org
Subject: Re: Expose system Serial Number to userspace.
Il 29/08/2012 17:18, Brad Arnold ha scritto:
> Hi,
>
> I'm working on an embedded board which uses u-boot + linux. At
> manufacturing time, the device serial number will be programmed into
> OTP memory on NAND (probably from within u-boot). We'd like the linux
> kernel to make this serial number available to be read from userspace.
> Is there an accepted method to do this sort of thing?
>
> One idea I had was to make the serial number available as a device
> node
> (ie: you can simply read the serial number from "/dev/serialnumber").
> Then there's the question of how the kernel learns the serial in the
> first place (a kernel boot command like parameter passed from u-boot?).
>
> Does this sound sane, or is there a better way to do something like
this?
>
> Thanks,
>
> Brad
U-Boot manage a serial number via env variable "serial#". It provides
several tools. You'll find under tools/env applications to read/write env
variable of uboot, so reading from Linux is very simple. You should use a
dedicated little space of flash to store the env variables.
Regards,
Marco
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Expose system Serial Number to userspace.
2012-08-29 16:57 ` Brad Arnold
@ 2012-08-29 17:07 ` Marco Stornelli
0 siblings, 0 replies; 8+ messages in thread
From: Marco Stornelli @ 2012-08-29 17:07 UTC (permalink / raw)
To: Brad Arnold; +Cc: linux-embedded
Il 29/08/2012 18:57, Brad Arnold ha scritto:
> That'll help me move along. I'm currently storing the mac and serial in
> the u-boot environment, but I was thinking I might want to move those two
> to the OTP. But at least having some level of write protection in u-boot
> is nice. I wasn't aware that this existed, because it's disabled by
> default in the config for Marvell boards.
>
> I'll have to look at that example program futher...
>
> Brad
>
>
(Please no top-posting). Of course, if you have got a separate flash
partition for the uboot env, you can map it read-only in linux, it's safer.
Marco
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-29 20:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-29 15:18 Expose system Serial Number to userspace Brad Arnold
2012-08-29 15:50 ` Nicolas Pitre
2012-08-29 16:53 ` Brad Arnold
2012-08-29 20:47 ` Brad Arnold
2012-08-29 20:52 ` Nicolas Pitre
2012-08-29 16:05 ` Marco Stornelli
2012-08-29 16:57 ` Brad Arnold
2012-08-29 17:07 ` Marco Stornelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).