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 "partitions=mtdparts=AT45DB642.spi0:132k(bootloader),33k(ubparams),99k(spare),1056k(linux),2112k(rootfs),33k(nvram),-(rootfs_data)\0"
39 "fbargs=setenv bootargs mtdparts=AT45DB642.spi0:132k(bootloader),33k(ubparams),99k(spare),1056k(linux),2112k(rootfs),33k(nvram),-(rootfs_data) root=/dev/mtdblock4 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
40 "rdba=setenv bootargs mtdparts=AT45DB642.spi0:132k(bootloader),33k(ubparams),99k(spare),1056k(linux),2112k(rootfs),33k(nvram),-(rootfs_data) root=/dev/ram rw initrd=0x21200000,6000000 ramdisk_size=20000 init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
41 "rdram=run rdba; tftp 21000000 vImage; tftp 21200000 root.squashfs; bootm 21000000\0"
42 "flash=run fbargs; bootm 0xc0042000\0"
43 "bootargs=setenv bootargs mtdparts=AT45DB642.spi0:132k(bootloader),33k(ubparams),99k(spare),1056k(linux),2112k(rootfs),33k(nvram),-(rootfs_data) root=/dev/mtdblock4 ro init=/etc/preinit console=/dev/ttyS0,115200,mem=32M\0"
44 "bootcmd=bootm 0xc0042000\0"
46 "serverip=10.0.1.210\0"
50 int main(int argc
, char *argv
[]) {
63 printf ("Invalid arguments\n");
69 if (strcmp(argv
[3], "--serial") == 0) {
71 sprintf(newser
, "serial#=%s", argv
[4]);
75 if (strcmp(argv
[1], "--mac") == 0) {
77 sprintf(newmac
, "ethaddr=%s", argv
[2]);
85 printf("Invalid arguments\n");
90 src
= srcptr
= *environment
;
91 envptr
= (env_t
*)malloc(CFG_ENV_SIZE
);
92 dataptr
= (char *)envptr
+ ENV_HEADER_SIZE
;
95 //printf("%d, %s\n", strlen(srcptr), srcptr);
96 paramlen
+= strlen(srcptr
) + 1;
97 srcptr
+= strlen(srcptr
) + 1;
100 printf("Make u-boot params\n");
101 printf("Params size is %d\n", CFG_ENV_SIZE
);
103 memset(envptr
, 0, CFG_ENV_SIZE
);
104 memcpy(dataptr
, src
, paramlen
);
108 memcpy(dataptr
, newmac
, strlen(newmac
));
109 dataptr
+= strlen(newmac
) + 1;
113 memcpy(dataptr
, newser
, strlen(newser
));
114 dataptr
+= strlen(newser
) + 1;
117 envptr
->crc
= crc32(0, envptr
->data
, ENV_SIZE
);
119 params
= fopen("params", "w");
120 fwrite(envptr
, CFG_ENV_SIZE
, 1, params
);
This page took 0.057244 seconds and 5 git commands to generate.