From 604782648ad588e1fda16ed8c6b750b8c988a4a3 Mon Sep 17 00:00:00 2001 From: Hamish Guthrie Date: Wed, 4 Apr 2007 14:33:52 +0000 Subject: [PATCH] Cleanups on romboot and u-boot. Conditionally apply ldd and ldconfig support on at91 platform SVN-Revision: 6862 --- target/linux/at91-2.6/image/romboot/Makefile | 2 + .../romboot/patches/004-code-cleanup.patch | 423 ++++++++++++++++++ .../patches/010-irda-patch-remove.patch | 13 + toolchain/uClibc/Makefile | 2 + 4 files changed, 440 insertions(+) create mode 100644 target/linux/at91-2.6/image/romboot/patches/004-code-cleanup.patch create mode 100644 target/linux/at91-2.6/image/u-boot/patches/010-irda-patch-remove.patch diff --git a/target/linux/at91-2.6/image/romboot/Makefile b/target/linux/at91-2.6/image/romboot/Makefile index aa679aba76..586a4813bd 100644 --- a/target/linux/at91-2.6/image/romboot/Makefile +++ b/target/linux/at91-2.6/image/romboot/Makefile @@ -19,6 +19,8 @@ PKG_SOURCE_URL:=http://www.teest.com/at91 PKG_MD5SUM:= PKG_CAT:=zcat +CRLF_WORKAROUND=1 + include $(INCLUDE_DIR)/package.mk define Build/InstallDev diff --git a/target/linux/at91-2.6/image/romboot/patches/004-code-cleanup.patch b/target/linux/at91-2.6/image/romboot/patches/004-code-cleanup.patch new file mode 100644 index 0000000000..1a0f9c559f --- /dev/null +++ b/target/linux/at91-2.6/image/romboot/patches/004-code-cleanup.patch @@ -0,0 +1,423 @@ +diff -urN romboot.old/com.cpp romboot/com.cpp +--- romboot.old/com.cpp 2004-07-04 21:37:05.000000000 +0200 ++++ romboot/com.cpp 2007-04-04 04:30:12.000000000 +0200 +@@ -27,7 +27,7 @@ + //*----------------------------------------------------------------------------- + void AT91F_ClrScr(void) + { +- puts(CLRSCREEN); ++ putstr(CLRSCREEN); + } + + +@@ -47,12 +47,12 @@ + + if (*(--p) == '\t') { /* will retype the whole line */ + while (*colp > plen) { +- puts(erase_seq); ++ putstr(erase_seq); + (*colp)--; + } + for (s=buffer; s plen) + { +- puts(erase_seq); ++ putstr(erase_seq); + --col; + } + p = console_buffer; +@@ -152,7 +152,7 @@ + void AT91F_WaitKeyPressed(void) + { + int c; +- puts("Hit a Key!"); ++ putstr("Hit a Key!"); + c = getc(); + } + +diff -urN romboot.old/main.cpp romboot/main.cpp +--- romboot.old/main.cpp 2007-04-03 12:12:33.000000000 +0200 ++++ romboot/main.cpp 2007-04-04 05:56:39.000000000 +0200 +@@ -382,8 +382,10 @@ + + AT91F_MCI_ReadBlockSwab(&MCI_Device, block*Max_Read_DataBlock_Length, (unsigned int *)bufpos, Max_Read_DataBlock_Length); + +- if (p->magic != TRX_MAGIC) ++ if (p->magic != TRX_MAGIC) { ++ printf("Invalid Image 0x%08x\n\r"); + return FALSE; ++ } + + printf("Read SD-Card\n\r"); + AT91C_BASE_PIOC->PIO_CODR = AT91C_PIO_PC7 | AT91C_PIO_PC15 | AT91C_PIO_PC8 | AT91C_PIO_PC14; +@@ -438,9 +440,6 @@ + int NbPage; + int mci_present; + +- stdin = fopen(0, at91_dbgu_getc); +- stdout = fopen(at91_dbgu_putc, 0); +- + pAT91 = AT91C_ROM_BOOT_ADDRESS; + + // Tempo Initialisation +@@ -472,16 +471,18 @@ + + #ifdef PRODTEST + if (mci_present) { +- Program_From_MCI(); +- AT91F_StartUboot(0, (void *)0); ++ if (Program_From_MCI()) ++ AT91F_StartUboot(0, (void *)0); + } + #endif + + // start tempo to start Uboot in a delay of 1 sec if no key pressed + svcUbootTempo.Start(&svcUbootTempo, 1000, 0, AT91F_StartUboot, (void *)0); + ++#ifndef PRODTEST + printf("press key\n\r"); + getc(); ++#endif + + // stop tempo + svcUbootTempo.Stop(&svcUbootTempo); +@@ -601,3 +602,10 @@ + AT91F_WaitKeyPressed(); + } + } ++ ++ ++int puts(const char *str) ++{ ++ putstr(str); ++ return 0; ++} +diff -urN romboot.old/stdio.cpp romboot/stdio.cpp +--- romboot.old/stdio.cpp 2004-07-04 22:36:10.000000000 +0200 ++++ romboot/stdio.cpp 2007-04-04 04:29:25.000000000 +0200 +@@ -1,117 +1,32 @@ + #include "stdio.h" + + extern int at91_dbgu_putc(int ch); ++extern int at91_dbgu_getc(); + +-FILE *stdout = (FILE *)0; +-FILE *stdin = (FILE *)0; +- +-FILE __filedesc[FILEDESCS]; +- +-FILE *fopen(int (*put)(int), int (*get)()) +-{ +- static int init = 1; +- +- if(init != 0) +- { +- for(int i = 0; i < FILEDESCS; i++) +- { +- __filedesc[i].active = false; +- __filedesc[i].put = 0; +- __filedesc[i].get = 0; +- } +- +- init = 0; +- } +- +- for(int i = 0; i < FILEDESCS; i++) +- { +- if(!__filedesc[i].active) +- { +- __filedesc[i].put = put; +- __filedesc[i].get = get; +- +- __filedesc[i].active = true; +- +- return &__filedesc[i]; +- } +- } +- +- return (FILE *)0; +-} +- +-int fclose(FILE *fp) ++int putstr(const char *str) + { +- for(int i = 0; i < FILEDESCS; i++) +- if(&__filedesc[i] == fp || fp->active) +- { +- fp->active = false; +- +- fp->put = 0; +- fp->get = 0; +- +- return 0; +- } +- +- return -1; +-} +- +-int fputs(const char *str, FILE *fp) +-{ +- if(fp == (FILE *)0) +- return -1; +- +- if(fp->put == (void *)0) +- return -1; +- +- while(*str != 0) +- { +- fp->put(*str); +- str++; +- } ++ while (*str != 0) ++ { ++ putc(*str); ++ str++; ++ } + return 0; + } + +-int fputc(int c, FILE *fp) +-{ +- if(fp == (FILE *)0) +- return -1; +- +- if(fp->put == (void *)0) +- return -1; +- +- return fp->put(c); +-} +- +-int fgetc(FILE *fp) +-{ +- if(fp == (FILE *)0) +- return -1; +- +- if(fp->get == (void *)0) +- return -1; +- +- return fp->get(); +-} +- +- +-int puts(const char *str) ++int putchar(int c) + { +- return fputs(str, stdout); ++ return putc(c); + } + + int putc(int c) + { +- return fputc(c, stdout); +-} +- +-int putchar(int c) +-{ +- return fputc(c, stdout); ++ at91_dbgu_putc(c); ++ return 0; + } + + int getc() + { +- return fgetc(stdin); ++ return at91_dbgu_getc(); + } + + int strlen(const char *str) +@@ -139,7 +54,7 @@ + __res; \ + }) + +-int number(FILE *fp, int num, int base, int size, int precision, int type) ++int number(int num, int base, int size, int precision, int type) + { + char c, sign, tmp[66]; + const char *digits="0123456789abcdef"; +@@ -173,28 +88,28 @@ + + if(!(type&(ZEROPAD+LEFT))) + while(size-->0) +- fputc(' ', fp); ++ putc(' '); + + if(sign) +- fputc(sign, fp); ++ putc(sign); + + if (!(type & LEFT)) + while (size-- > 0) +- fputc(c, fp); ++ putc(c); + + while (i < precision--) +- fputc('0', fp); ++ putc('0'); + + while (i-- > 0) +- fputc(tmp[i], fp); ++ putc(tmp[i]); + + while (size-- > 0) +- fputc(' ', fp);; ++ putc(' ');; + + return 1; + } + +-int vfprintf(FILE *fp, const char *fmt, va_list va) ++int vprintf(const char *fmt, va_list va) + { + char *s; + +@@ -231,33 +146,33 @@ + case 's' : + s = va_arg(va, char *); + if(!s) +- fputs("", fp); ++ putstr(""); + else +- fputs(s, fp); ++ putstr(s); + done = true; + break; + case 'c' : +- fputc(va_arg(va, int), fp); ++ putc(va_arg(va, int)); + done = true; + break; + case 'd' : +- number(fp, va_arg(va, int), 10, 0, precision, type); ++ number(va_arg(va, int), 10, 0, precision, type); + done = true; + break; + case 'x' : +- number(fp, va_arg(va, int), 16, 0, precision, type); ++ number(va_arg(va, int), 16, 0, precision, type); + done = true; + break; + case 'X' : +- number(fp, va_arg(va, int), 16, 0, precision, type | LARGE); ++ number(va_arg(va, int), 16, 0, precision, type | LARGE); + done = true; + break; + case '%' : +- fputc(*fmt, fp); ++ putc(*fmt); + done = true; + default: +- fputc('%', fp); +- fputc(*fmt, fp); ++ putc('%'); ++ putc(*fmt); + done = true; + break; + } +@@ -265,7 +180,7 @@ + while(!done); + } + else +- fputc(*fmt, fp); ++ putc(*fmt); + + fmt++; + } +@@ -274,25 +189,13 @@ + return 0; + } + +-int fprintf(FILE *fp, const char *fmt, ...) +-{ +- va_list ap; +- int i; +- +- va_start(ap, fmt); +- i = fprintf(fp, fmt, ap); +- va_end(ap); +- +- return i; +-} +- + int printf(const char *fmt, ...) + { + va_list ap; + int i; + + va_start(ap, fmt); +- i = vfprintf(stdout, fmt, ap); ++ i = vprintf(fmt, ap); + va_end(ap); + + return i; +diff -urN romboot.old/stdio.h romboot/stdio.h +--- romboot.old/stdio.h 2004-07-04 22:04:27.000000000 +0200 ++++ romboot/stdio.h 2007-04-04 04:29:48.000000000 +0200 +@@ -1,31 +1,12 @@ + #include + +-struct FILE +-{ +- bool active; +- int (*put)(int); /* function to write one char to device */ +- int (*get)(); /* function to read one char from device */ +-}; +- +-#define FILEDESCS 8 +- +-FILE *fopen(int (*put)(int), int (*get)()); +-int fclose(FILE *fp); +- +-int puts(const char *str); ++int putstr(const char *str); + int putc(int c); + int putchar(int c); + int getc(); + +-int fputs(const char *str, FILE *fp); +-int fputc(int c, FILE *fp); +-int fgetc(FILE *fp); + int strlen(const char *str); + +-int fprintf(FILE *fp, const char *fmt, ...); +-int vfprintf(FILE *fp, const char *fmt, va_list ap); ++int vprintf(const char *fmt, va_list ap); + + int printf(const char *fmt, ...); +- +-extern FILE *stdout; +-extern FILE *stdin; diff --git a/target/linux/at91-2.6/image/u-boot/patches/010-irda-patch-remove.patch b/target/linux/at91-2.6/image/u-boot/patches/010-irda-patch-remove.patch new file mode 100644 index 0000000000..2f23f5b38b --- /dev/null +++ b/target/linux/at91-2.6/image/u-boot/patches/010-irda-patch-remove.patch @@ -0,0 +1,13 @@ +--- u-boot-1.1.4.old/board/vlink/vlink.c 2007-04-03 11:42:39.000000000 +0200 ++++ u-boot-1.1.4/board/vlink/vlink.c 2007-04-03 11:48:33.000000000 +0200 +@@ -40,10 +40,6 @@ + /* Enable Ctrlc */ + console_init_f (); + +- /* Correct IRDA resistor problem */ +- /* Set PA23_TXD in Output */ +- (AT91PS_PIO) AT91C_BASE_PIOA->PIO_OER = AT91C_PA23_TXD2; +- + /* memory and cpu-speed are setup before relocation */ + /* so we do _nothing_ here */ + diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile index 2f95b0c44f..93a994ebb6 100644 --- a/toolchain/uClibc/Makefile +++ b/toolchain/uClibc/Makefile @@ -93,12 +93,14 @@ define Build/Install RUNTIME_PREFIX=/ \ install_dev echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version +ifneq ($(CONFIG_LINUX_2_6_AT91),y) echo $(PKG_VERSION)$(PKG_EXTRAVERSION) > $(STAGING_DIR)/uclibc_extra_version $(MAKE) -C $(PKG_BUILD_DIR) \ PREFIX=$(STAGING_DIR)/ \ DEVEL_PREFIX=/ \ RUNTIME_PREFIX=/ \ utils +endif endef define Build/Clean -- 2.35.1