Re: [U-Boot] setting u-boot params based on serial number

2009-10-26 Thread Wolfgang Denk
Dear "David Collier", In message you wrote: > > I concede I can indeed do the one thing I need here by using decimal > values with hex arithmetic, and it will give the right answer. > > though it is truly horrible coding :-) You misunderstand. You misunderstand completly. Exstracting the las

Re: [U-Boot] setting u-boot params based on serial number

2009-10-26 Thread David Collier
OK, I concede I can indeed do the one thing I need here by using decimal values with hex arithmetic, and it will give the right answer. though it is truly horrible coding :-) I can see situations where I'd want to do something like "add one to the last serial number I used" where decimal arithm

Re: [U-Boot] setting u-boot params based on serial number

2009-10-26 Thread Wolfgang Denk
Dear "David Collier", In message you wrote: > > I did not only describe it, I tested it. I just "tricked" a bit. > > You asked to extract the last two digits, and I used "% 100" to do > > this. Note that this works correctly in any number base - may it be > > 10 or 16 or whatever :-) > > > > H

Re: [U-Boot] setting u-boot params based on serial number

2009-10-26 Thread David Collier
> I did not only describe it, I tested it. I just "tricked" a bit. > You asked to extract the last two digits, and I used "% 100" to do > this. Note that this works correctly in any number base - may it be > 10 or 16 or whatever :-) > > Hey, that was clever, wasn't it? :-) yeah it was - but of c

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread Wolfgang Denk
Dear "David Collier", In message you wrote: > > serialnumber=1234 > set_mac_IP=setexprd sn34 ${serialnumber} % 100 ;setexprd sn12 > ${serialnumber} / 100; setenv ipaddr 10.212.${sn12}.${sn34}; setenv > ethaddr 00:90:46:20:${sn12}:${sn34}; setenv eth1addr > 00:90:46:21:${sn12}:${sn34}; setenv sn

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread Wolfgang Denk
Dear "David Collier", In message you wrote: > > Well I have got it working - but it seems to do exactly what you say it > doesn't Well, I'm not always right :-) > so it looks like it works ONLY in hex - Makes sense. That's what semi-all commands do in U-Boot. > I'd like the decimal version

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread David Collier
wow serialnumber=1234 set_mac_IP=setexprd sn34 ${serialnumber} % 100 ;setexprd sn12 ${serialnumber} / 100; setenv ipaddr 10.212.${sn12}.${sn34}; setenv ethaddr 00:90:46:20:${sn12}:${sn34}; setenv eth1addr 00:90:46:21:${sn12}:${sn34}; setenv sn12 ; setenv sn34 that's seriously useful! TVM David

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread David Collier
Well I have got it working - but it seems to do exactly what you say it doesn't for instance LPNC U-Boot> printenv serialnumber serialnumber=410 LPNC U-Boot> setexpr sn34 ${serialnumber} / 2 LPNC U-Boot> printenv sn34 sn34=208 so it looks like it works ONLY in hex - yup a = simple_st

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread Wolfgang Denk
Dear "David Collier", In message you wrote: > > I have a batch of boards in production. > > say serial numbers 1 to 50 > > I want to set the 2 mac address, and the ip address so that the last few > digits match the serial number. > > can I do this easily with some sort of u-boot script? Or c

Re: [U-Boot] setting u-boot params based on serial number

2009-10-23 Thread Ben Warren
David Collier wrote: > This may be bloody obvious to most of you, but I'm still learning. > > I have a batch of boards in production. > > say serial numbers 1 to 50 > > I want to set the 2 mac address, and the ip address so that the last few > digits match the serial number. > > can I do this easil

[U-Boot] setting u-boot params based on serial number

2009-10-23 Thread David Collier
This may be bloody obvious to most of you, but I'm still learning. I have a batch of boards in production. say serial numbers 1 to 50 I want to set the 2 mac address, and the ip address so that the last few digits match the serial number. can I do this easily with some sort of u-boot script? Or