lua: Fixed some cross-platform issues for PPC (and probably other architectures)
[openwrt.git] / target / linux / at91 / image / u-boot / patches / 006-generate_params.patch
1 --- u-boot-1.1.4.old/tools/Makefile 2007-03-22 18:17:25.000000000 +0100
2 +++ u-boot-1.1.4/tools/Makefile 2007-03-22 17:08:46.000000000 +0100
3 @@ -21,9 +21,9 @@
4 # MA 02111-1307 USA
5 #
6
7 -BINS = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
8 +BINS = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) ubparams$(SFX)
9
10 -OBJS = environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o
11 +OBJS = environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o ubparams.o
12
13 ifeq ($(ARCH),mips)
14 BINS += inca-swap-bytes$(SFX)
15 @@ -118,6 +118,9 @@
16
17 all: .depend $(BINS) $(LOGO_H) subdirs
18
19 +ubparams$(SFX): ubparams.o crc32.o
20 + $(CC) $(CFLAGS) -o $@ $^
21 +
22 envcrc$(SFX): envcrc.o crc32.o environment.o
23 $(CC) $(CFLAGS) -o $@ $^
24
25 @@ -149,6 +152,9 @@
26 $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
27 $(STRIP) $@
28
29 +ubparams.o: ubparams.c
30 + $(CC) -g $(CFLAGS) -c $<
31 +
32 envcrc.o: envcrc.c
33 $(CC) -g $(CFLAGS) -c $<
34
35 --- u-boot-1.1.4.old/tools/ubparams.c 1970-01-01 01:00:00.000000000 +0100
36 +++ u-boot-1.1.4/tools/ubparams.c 2007-03-22 18:09:52.000000000 +0100
37 @@ -0,0 +1,78 @@
38 +/*
39 + * ubparams.c
40 + *
41 + * Generate a u-boot parameter block with correct crc
42 + *
43 + * (C) 1007 Guthrie Consulting
44 + * hamish@prodigi.ch
45 + *
46 + */
47 +
48 +#include <stdio.h>
49 +#include <stdlib.h>
50 +#include <string.h>
51 +
52 +#ifndef __ASSEMBLY__
53 +#define __ASSEMBLY__
54 +#endif
55 +#define __ASM_STUB_PROCESSOR_H__
56 +#include <config.h>
57 +#undef __ASSEMBLY__
58 +#include "environment.h"
59 +
60 +#define XMK_STR(x) #x
61 +#define MK_STR(x) XMK_STR(x)
62 +
63 +extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
64 +
65 +#if !defined(ENV_CRC)
66 +#define ENV_CRC ~0
67 +#endif
68 +
69 +unsigned int env_size = 0x8400;
70 +env_t environment = {
71 + ENV_CRC,
72 + "bootdelay=3\0"
73 + "baudrate=115200\0"
74 + "stdin=serial\0"
75 + "stdout=serial\0"
76 + "stderr=serial\0"
77 + "partitions=mtdparts=AT45DB642.spi0:132k(bootloader),33k(ubparams),99k(spare),1056k(linux),2112k(rootfs),33k(nvram),-(rootfs_data)\0"
78 + "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"
79 + "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"
80 + "rdram=run rdba; tftp 21000000 vImage; tftp 21200000 root.squashfs; bootm 21000000\0"
81 + "flash=run fbargs; bootm 0xc0042000\0"
82 + "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"
83 + "bootcmd=bootm 0xc0042000\0"
84 + "ethaddr=00:30:49:00:00:01\0"
85 + "ipaddr=10.0.1.73\0"
86 + "serverip=10.0.1.210\0"
87 + "serial#=MX070205484\0"
88 + "\0"
89 + };
90 +
91 +int main(void) {
92 + env_t *envptr, *source;
93 + unsigned char *dataptr;
94 + FILE *params;
95 +
96 + source = &environment;
97 + envptr = (env_t *)malloc(CFG_ENV_SIZE);
98 + dataptr = (unsigned char *)envptr + ENV_HEADER_SIZE;
99 +
100 + printf("Make u-boot params\n");
101 + printf("Params size is %d\n", CFG_ENV_SIZE);
102 +
103 + memset(envptr, 0, CFG_ENV_SIZE);
104 + memcpy(envptr, source, sizeof(environment));
105 +
106 + envptr->crc = crc32(0, envptr->data, ENV_SIZE);
107 +
108 + params = fopen("params", "w");
109 + fwrite(envptr, CFG_ENV_SIZE, 1, params);
110 + fclose(params);
111 +
112 + free(envptr);
113 + }
114 +
115 +
This page took 0.055312 seconds and 5 git commands to generate.