Skip to content

Commit b868dea

Browse files
committed
Add boot parameters to U-boot
1 parent 1b3888f commit b868dea

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

gen-rascal-binaries.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
3+
import csv, os, subprocess, sys
4+
5+
s = []
6+
with open('../../hash-mac-serial-0001-1000.csv', 'rb') as f:
7+
serials = csv.reader(f)
8+
for row in serials:
9+
s.append([row[0], row[1], row[2]])
10+
11+
os.environ['CROSS_COMPILE'] = 'arm-linux-'
12+
os.environ['PATH'] = os.environ['PATH'] + ':/opt/eldk/usr/bin:/opt/eldk/bin:/opt/cs/bin'
13+
14+
for i in range(int(sys.argv[1]), int(sys.argv[2]) + 1):
15+
pwhash = s[i][0]
16+
mac = s[i][1]
17+
serial = s[i][2]
18+
hostname = 'rascal' + serial[2:6].lstrip('0')
19+
20+
config_text ="""#define CONFIG_RASCAL_DEFAULT_PASSWORD_HASH {0}
21+
#define CONFIG_RASCAL_ETHADDR {1}
22+
#define CONFIG_RASCAL_HOSTNAME {2}""".format(pwhash, mac, hostname)
23+
24+
commands = [
25+
'env',
26+
'cp include/configs/rascal.h rascal.h.orig',
27+
'echo "' + config_text + '" >> include/configs/rascal.h',
28+
'make distclean; make rascal_config; make all',
29+
'cp u-boot.bin ../u-boot-{0}'.format(serial.lower()),
30+
'cp rascal.h.orig include/configs/rascal.h',
31+
]
32+
for cmd in commands:
33+
print(cmd)
34+
subprocess.Popen(cmd, shell=True)

include/configs/rascal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@
136136
/* Default environment variables */
137137
#define CONFIG_BOOTDELAY 3
138138
#define CONFIG_BOOTCOMMAND "sf probe 0 15000000 0; sf read 22000000 100000 2fffff; bootm 0x22000000"
139-
#define CONFIG_BOOTARGS "console=ttyS0,115200"
140-
#define CONFIG_ETHADDR 02:03:04:00:00:06
139+
#define CONFIG_BOOTARGS "console=ttyS0,115200 ip=::::CONFIG_RASCAL_HOSTNAME:: pwhash=CONFIG_RASCAL_DEFAULT_PASSWORD_HASH"
140+
#define CONFIG_ETHADDR CONFIG_RASCAL_ETHADDR
141141
#define CONFIG_BAUDRATE 115200
142142

143143
#define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 }

0 commit comments

Comments
 (0)