4 * Generate a u-boot parameter block with correct crc
6 * (C) 1007 Guthrie Consulting
18 #define __ASM_STUB_PROCESSOR_H__
21 #include <environment.h>
24 #define MK_STR(x) XMK_STR(x)
26 extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
32 static char *environment
[] = {
38 "fbargs=setenv bootargs root=/dev/mtdblock3 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
39 "rdba=setenv bootargs root=/dev/ram rw initrd=0x21200000,6000000 ramdisk_size=20000 init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
40 "rdram=run rdba; tftp 21000000 vImage; tftp 21200000 root.squashfs; bootm 21000000\0"
41 "flash=run fbargs; bootm 0xc0042000\0"
42 "bootargs=setenv bootargs root=/dev/mtdblock3 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
43 "bootcmd=bootm 0xc0042000\0"
45 "serverip=10.0.1.210\0"
49 int main(int argc
, char *argv
[]) {
62 printf ("Invalid arguments\n");
68 if (strcmp(argv
[3], "--serial") == 0) {
70 sprintf(newser
, "serial#=%s", argv
[4]);
74 if (strcmp(argv
[1], "--mac") == 0) {
76 sprintf(newmac
, "ethaddr=%s", argv
[2]);
84 printf("Invalid arguments\n");
89 src
= srcptr
= *environment
;
90 envptr
= (env_t
*)malloc(CFG_ENV_SIZE
);
91 dataptr
= (char *)envptr
+ ENV_HEADER_SIZE
;
94 //printf("%d, %s\n", strlen(srcptr), srcptr);
95 paramlen
+= strlen(srcptr
) + 1;
96 srcptr
+= strlen(srcptr
) + 1;
99 printf("Make u-boot params\n");
100 printf("Params size is %d\n", CFG_ENV_SIZE
);
102 memset(envptr
, 0, CFG_ENV_SIZE
);
103 memcpy(dataptr
, src
, paramlen
);
107 memcpy(dataptr
, newmac
, strlen(newmac
));
108 dataptr
+= strlen(newmac
) + 1;
112 memcpy(dataptr
, newser
, strlen(newser
));
113 dataptr
+= strlen(newser
) + 1;
116 envptr
->crc
= crc32(0, envptr
->data
, ENV_SIZE
);
118 params
= fopen("params", "w");
119 fwrite(envptr
, CFG_ENV_SIZE
, 1, params
);
This page took 0.055059 seconds and 5 git commands to generate.