From: mariusgroeger Date: Wed, 27 Mar 2002 13:48:44 +0000 (+0000) Subject: - Allow compilation without linux headers. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=97cfb9f5081bcba0f0783e4e8c2c3ce323b072d9;p=users%2Frw%2Farmboot.git - Allow compilation without linux headers. - Add README --- diff --git a/Makefile b/Makefile index 3e0b1db..4d4677e 100644 --- a/Makefile +++ b/Makefile @@ -31,12 +31,10 @@ HOSTARCH := $(shell uname -m | \ -e s/arm.*/arm/ \ -e s/sa110/arm/) -HOSTOS := $(shell uname -s | tr A-Z a-z) - ifeq ($(HOSTARCH),arm) CROSS_COMPILE = else -CROSS_COMPILE = arm-$(HOSTOS)- +CROSS_COMPILE = arm-linux- endif export CROSS_COMPILE HOSTARCH diff --git a/README b/README new file mode 100644 index 0000000..20acf1e --- /dev/null +++ b/README @@ -0,0 +1,106 @@ +# +# (C) Copyright 2002 +# SYSGO Real-Time Solutions GmbH +# +# http://www.sysgo.de +# http://www.elinos.com +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA + + +Overview +======== + +ARMboot is a firmware monitor/bootloader for embedded systems based +on ARM or StrongARM CPUs. The primary objectives for this software is +to be easily portable to new platforms while being as powerful as possible. +To date it is the only GPL'ed ARM firmware capable of supporting multiple +types of flash memory, network download via bootp, dhcp, tftp, PCMCIA CF +booting and more. + +ARMboot is heavily based on the sister project PPCboot. It is planned, to +move both projects even close together to increase their robustness and +mutual benefit. + + +Getting ARMboot +=============== + +ARMboot is hosted on Sourceforge: + + http://www.sourceforge.net/projects/armboot + +The lastest version can always be obtained via the anonymous CVS access of +Sourceforge. Tarballs are released sporadically, and can be downloaded from +the same site. + + +Mailing List +============ + +Questions regarding the use and porting of ARMboot should be posted to the +ARMboot mailing list. You can subscibe here: + + http://lists.sourceforge.net/lists/listinfo/armboot-users/ + +If you want to get help on a certin issue, please go first to the +mailing list's archive to whether that question has been discussed in the +past. + + +Building ARMboot +================ + +To configure and build ARMboot you will need a GNU cross development +tool-chain configured for arm-linux. You should NOT need any linux header +files. If so, please report this on the mailing list. + +The cross development tools usually have a target specific prefix. For +instance, your cross compiler may be called "arm-linux-gcc" or +"arm_armv4-gcc". This prefix can be passed to the Makefile by setting the +CROSS_COMPILE variable, which defaults to "arm-linux-". + +The following example is for the "LART" board: + +1. Configure + + sh# make lart_config + rm -f include/config.h include/config.mk + Configuring for lart Board... + +2. Build + + sh# make all + ... + arm_armv4-objcopy -O srec armboot armboot.srec + arm_armv4-objcopy -O binary armboot armboot.bin + + +Supported Hardware +================== + +Board Configuration Notes +-------------------------------------------------------------------------- +LART lart_config "Linux ARM Radio Terminal" +SSV DNP1110 dnp1110_config SSV DilNET PC (no flash support) +Shannon shannon_config Tuxscreen (no support for + IrDA keyboard, LCD screen) +implementa impA7 impa7_config EP7211 based +CLEP7312 ep7312_config Cirrus Logic EP7312 Dev. Board + diff --git a/board/dnp1110/dnp1110.c b/board/dnp1110/dnp1110.c index 94002bd..67974c4 100644 --- a/board/dnp1110/dnp1110.c +++ b/board/dnp1110/dnp1110.c @@ -23,7 +23,6 @@ */ #include "armboot.h" -#include "sa1100.h" /* ------------------------------------------------------------------------- */ diff --git a/board/dnp1110/flash.c b/board/dnp1110/flash.c index 6cd2d82..732bded 100644 --- a/board/dnp1110/flash.c +++ b/board/dnp1110/flash.c @@ -22,7 +22,6 @@ * MA 02111-1307 USA */ - #include "armboot.h" ulong myflush(void); diff --git a/board/lart/flash.c b/board/lart/flash.c index eb557df..aba7868 100644 --- a/board/lart/flash.c +++ b/board/lart/flash.c @@ -22,7 +22,6 @@ * MA 02111-1307 USA */ - #include "armboot.h" ulong myflush(void); diff --git a/board/lart/lart.c b/board/lart/lart.c index 47567a9..54e7971 100644 --- a/board/lart/lart.c +++ b/board/lart/lart.c @@ -23,7 +23,6 @@ */ #include "armboot.h" -#include "sa1100.h" /* ------------------------------------------------------------------------- */ diff --git a/board/shannon/flash.c b/board/shannon/flash.c index a51cced..0841956 100644 --- a/board/shannon/flash.c +++ b/board/shannon/flash.c @@ -22,7 +22,6 @@ * MA 02111-1307 USA */ - #include "armboot.h" ulong myflush(void); diff --git a/board/shannon/shannon.c b/board/shannon/shannon.c index 5d4d3ed..54286ab 100644 --- a/board/shannon/shannon.c +++ b/board/shannon/shannon.c @@ -23,7 +23,6 @@ */ #include "armboot.h" -#include "sa1100.h" /* ------------------------------------------------------------------------- */ diff --git a/common/armlinux.c b/common/armlinux.c index b0ebf35..66e4330 100644 --- a/common/armlinux.c +++ b/common/armlinux.c @@ -28,7 +28,7 @@ #include "malloc.h" #include "zlib.h" -#include +#include #define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) #define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) diff --git a/cpu/sa1100/interrupts.c b/cpu/sa1100/interrupts.c index c9cbe53..7df4ee2 100644 --- a/cpu/sa1100/interrupts.c +++ b/cpu/sa1100/interrupts.c @@ -27,7 +27,7 @@ */ #include "armboot.h" -#include "sa1100.h" +#include "SA-1100.h" #include "ptregs.h" extern void reset_cpu(ulong addr); diff --git a/cpu/sa1100/serial.c b/cpu/sa1100/serial.c index 8a24280..8827743 100644 --- a/cpu/sa1100/serial.c +++ b/cpu/sa1100/serial.c @@ -26,7 +26,7 @@ */ #include "armboot.h" -#include "sa1100.h" +#include "SA-1100.h" void serial_setbrg(bd_t *bd, int baudrate) { diff --git a/include/SA-1100.h b/include/SA-1100.h index 03bd8db..f1f9625 100644 --- a/include/SA-1100.h +++ b/include/SA-1100.h @@ -18,12 +18,6 @@ */ -/* Be sure that virtual mapping is defined right */ -#ifndef __ASM_ARCH_HARDWARE_H -#error You must include hardware.h not SA-1100.h -#endif - - #ifndef LANGUAGE # ifdef __ASSEMBLY__ # define LANGUAGE Assembly @@ -36,7 +30,7 @@ #define io_p2v(PhAdd) (PhAdd) #endif -#include +#include #define C 0 #define Assembly 1 diff --git a/include/asm/arch-sa1100/bitfield.h b/include/asm/arch-sa1100/bitfield.h new file mode 100644 index 0000000..f1f0e33 --- /dev/null +++ b/include/asm/arch-sa1100/bitfield.h @@ -0,0 +1,113 @@ +/* + * FILE bitfield.h + * + * Version 1.1 + * Author Copyright (c) Marc A. Viredaz, 1998 + * DEC Western Research Laboratory, Palo Alto, CA + * Date April 1998 (April 1997) + * System Advanced RISC Machine (ARM) + * Language C or ARM Assembly + * Purpose Definition of macros to operate on bit fields. + */ + + + +#ifndef __BITFIELD_H +#define __BITFIELD_H + +#ifndef __ASSEMBLY__ +#define UData(Data) ((unsigned long) (Data)) +#else +#define UData(Data) (Data) +#endif + + +/* + * MACRO: Fld + * + * Purpose + * The macro "Fld" encodes a bit field, given its size and its shift value + * with respect to bit 0. + * + * Note + * A more intuitive way to encode bit fields would have been to use their + * mask. However, extracting size and shift value information from a bit + * field's mask is cumbersome and might break the assembler (255-character + * line-size limit). + * + * Input + * Size Size of the bit field, in number of bits. + * Shft Shift value of the bit field with respect to bit 0. + * + * Output + * Fld Encoded bit field. + */ + +#define Fld(Size, Shft) (((Size) << 16) + (Shft)) + + +/* + * MACROS: FSize, FShft, FMsk, FAlnMsk, F1stBit + * + * Purpose + * The macros "FSize", "FShft", "FMsk", "FAlnMsk", and "F1stBit" return + * the size, shift value, mask, aligned mask, and first bit of a + * bit field. + * + * Input + * Field Encoded bit field (using the macro "Fld"). + * + * Output + * FSize Size of the bit field, in number of bits. + * FShft Shift value of the bit field with respect to bit 0. + * FMsk Mask for the bit field. + * FAlnMsk Mask for the bit field, aligned on bit 0. + * F1stBit First bit of the bit field. + */ + +#define FSize(Field) ((Field) >> 16) +#define FShft(Field) ((Field) & 0x0000FFFF) +#define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field)) +#define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1) +#define F1stBit(Field) (UData (1) << FShft (Field)) + + +/* + * MACRO: FInsrt + * + * Purpose + * The macro "FInsrt" inserts a value into a bit field by shifting the + * former appropriately. + * + * Input + * Value Bit-field value. + * Field Encoded bit field (using the macro "Fld"). + * + * Output + * FInsrt Bit-field value positioned appropriately. + */ + +#define FInsrt(Value, Field) \ + (UData (Value) << FShft (Field)) + + +/* + * MACRO: FExtr + * + * Purpose + * The macro "FExtr" extracts the value of a bit field by masking and + * shifting it appropriately. + * + * Input + * Data Data containing the bit-field to be extracted. + * Field Encoded bit field (using the macro "Fld"). + * + * Output + * FExtr Bit-field value. + */ + +#define FExtr(Data, Field) \ + ((UData (Data) >> FShft (Field)) & FAlnMsk (Field)) + + +#endif /* __BITFIELD_H */ diff --git a/include/asm/setup.h b/include/asm/setup.h new file mode 100644 index 0000000..b9d7ba1 --- /dev/null +++ b/include/asm/setup.h @@ -0,0 +1,263 @@ +/* + * linux/include/asm/setup.h + * + * Copyright (C) 1997-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Structure passed to kernel to tell it about the + * hardware it's running on. See linux/Documentation/arm/Setup + * for more info. + * + * NOTE: + * This file contains two ways to pass information from the boot + * loader to the kernel. The old struct param_struct is deprecated, + * but it will be kept in the kernel for 5 years from now + * (2001). This will allow boot loaders to convert to the new struct + * tag way. + */ +#ifndef __ASMARM_SETUP_H +#define __ASMARM_SETUP_H + +/* + * Usage: + * - do not go blindly adding fields, add them at the end + * - when adding fields, don't rely on the address until + * a patch from me has been released + * - unused fields should be zero (for future expansion) + * - this structure is relatively short-lived - only + * guaranteed to contain useful data in setup_arch() + */ +#define COMMAND_LINE_SIZE 1024 + +/* This is the old deprecated way to pass parameters to the kernel */ +struct param_struct { + union { + struct { + unsigned long page_size; /* 0 */ + unsigned long nr_pages; /* 4 */ + unsigned long ramdisk_size; /* 8 */ + unsigned long flags; /* 12 */ +#define FLAG_READONLY 1 +#define FLAG_RDLOAD 4 +#define FLAG_RDPROMPT 8 + unsigned long rootdev; /* 16 */ + unsigned long video_num_cols; /* 20 */ + unsigned long video_num_rows; /* 24 */ + unsigned long video_x; /* 28 */ + unsigned long video_y; /* 32 */ + unsigned long memc_control_reg; /* 36 */ + unsigned char sounddefault; /* 40 */ + unsigned char adfsdrives; /* 41 */ + unsigned char bytes_per_char_h; /* 42 */ + unsigned char bytes_per_char_v; /* 43 */ + unsigned long pages_in_bank[4]; /* 44 */ + unsigned long pages_in_vram; /* 60 */ + unsigned long initrd_start; /* 64 */ + unsigned long initrd_size; /* 68 */ + unsigned long rd_start; /* 72 */ + unsigned long system_rev; /* 76 */ + unsigned long system_serial_low; /* 80 */ + unsigned long system_serial_high; /* 84 */ + unsigned long mem_fclk_21285; /* 88 */ + } s; + char unused[256]; + } u1; + union { + char paths[8][128]; + struct { + unsigned long magic; + char n[1024 - sizeof(unsigned long)]; + } s; + } u2; + char commandline[COMMAND_LINE_SIZE]; +}; + + + +/* + * The new way of passing information: a list of tagged entries + */ + +/* The list ends with an ATAG_NONE node. */ +#define ATAG_NONE 0x00000000 + +struct tag_header { + u32 size; + u32 tag; +}; + +/* The list must start with an ATAG_CORE node */ +#define ATAG_CORE 0x54410001 + +struct tag_core { + u32 flags; /* bit 0 = read-only */ + u32 pagesize; + u32 rootdev; +}; + +/* it is allowed to have multiple ATAG_MEM nodes */ +#define ATAG_MEM 0x54410002 + +struct tag_mem32 { + u32 size; + u32 start; /* physical start address */ +}; + +/* VGA text type displays */ +#define ATAG_VIDEOTEXT 0x54410003 + +struct tag_videotext { + u8 x; + u8 y; + u16 video_page; + u8 video_mode; + u8 video_cols; + u16 video_ega_bx; + u8 video_lines; + u8 video_isvga; + u16 video_points; +}; + +/* describes how the ramdisk will be used in kernel */ +#define ATAG_RAMDISK 0x54410004 + +struct tag_ramdisk { + u32 flags; /* bit 0 = load, bit 1 = prompt */ + u32 size; /* decompressed ramdisk size in _kilo_ bytes */ + u32 start; /* starting block of floppy-based RAM disk image */ +}; + +/* describes where the compressed ramdisk image lives */ +#define ATAG_INITRD 0x54410005 + +struct tag_initrd { + u32 start; /* physical start address */ + u32 size; /* size of compressed ramdisk image in bytes */ +}; + +/* board serial number. "64 bits should be enough for everybody" */ +#define ATAG_SERIAL 0x54410006 + +struct tag_serialnr { + u32 low; + u32 high; +}; + +/* board revision */ +#define ATAG_REVISION 0x54410007 + +struct tag_revision { + u32 rev; +}; + +/* initial values for vesafb-type framebuffers. see struct screen_info + * in include/linux/tty.h + */ +#define ATAG_VIDEOLFB 0x54410008 + +struct tag_videolfb { + u16 lfb_width; + u16 lfb_height; + u16 lfb_depth; + u16 lfb_linelength; + u32 lfb_base; + u32 lfb_size; + u8 red_size; + u8 red_pos; + u8 green_size; + u8 green_pos; + u8 blue_size; + u8 blue_pos; + u8 rsvd_size; + u8 rsvd_pos; +}; + +/* command line: \0 terminated string */ +#define ATAG_CMDLINE 0x54410009 + +struct tag_cmdline { + char cmdline[1]; /* this is the minimum size */ +}; + +/* acorn RiscPC specific information */ +#define ATAG_ACORN 0x41000101 + +struct tag_acorn { + u32 memc_control_reg; + u32 vram_pages; + u8 sounddefault; + u8 adfsdrives; +}; + +/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */ +#define ATAG_MEMCLK 0x41000402 + +struct tag_memclk { + u32 fmemclk; +}; + +struct tag { + struct tag_header hdr; + union { + struct tag_core core; + struct tag_mem32 mem; + struct tag_videotext videotext; + struct tag_ramdisk ramdisk; + struct tag_initrd initrd; + struct tag_serialnr serialnr; + struct tag_revision revision; + struct tag_videolfb videolfb; + struct tag_cmdline cmdline; + + /* + * Acorn specific + */ + struct tag_acorn acorn; + + /* + * DC21285 specific + */ + struct tag_memclk memclk; + } u; +}; + +struct tagtable { + u32 tag; + int (*parse)(const struct tag *); +}; + +#define __tag __attribute__((unused, __section__(".taglist"))) +#define __tagtable(tag, fn) \ +static struct tagtable __tagtable_##fn __tag = { tag, fn } + +#define tag_member_present(tag,member) \ + ((unsigned long)(&((struct tag *)0L)->member + 1) \ + <= (tag)->hdr.size * 4) + +#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) +#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) + +#define for_each_tag(t,base) \ + for (t = base; t->hdr.size; t = tag_next(t)) + +/* + * Memory map description + */ +#define NR_BANKS 8 + +struct meminfo { + int nr_banks; + unsigned long end; + struct { + unsigned long start; + unsigned long size; + int node; + } bank[NR_BANKS]; +}; + +extern struct meminfo meminfo; + +#endif diff --git a/include/linux/ctype.h b/include/linux/ctype.h new file mode 100644 index 0000000..afa3639 --- /dev/null +++ b/include/linux/ctype.h @@ -0,0 +1,54 @@ +#ifndef _LINUX_CTYPE_H +#define _LINUX_CTYPE_H + +/* + * NOTE! This ctype does not handle EOF like the standard C + * library is required to. + */ + +#define _U 0x01 /* upper */ +#define _L 0x02 /* lower */ +#define _D 0x04 /* digit */ +#define _C 0x08 /* cntrl */ +#define _P 0x10 /* punct */ +#define _S 0x20 /* white space (space/lf/tab) */ +#define _X 0x40 /* hex digit */ +#define _SP 0x80 /* hard space (0x20) */ + +extern unsigned char _ctype[]; + +#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) + +#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) +#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) +#define iscntrl(c) ((__ismask(c)&(_C)) != 0) +#define isdigit(c) ((__ismask(c)&(_D)) != 0) +#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) +#define islower(c) ((__ismask(c)&(_L)) != 0) +#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) +#define ispunct(c) ((__ismask(c)&(_P)) != 0) +#define isspace(c) ((__ismask(c)&(_S)) != 0) +#define isupper(c) ((__ismask(c)&(_U)) != 0) +#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) + +#define isascii(c) (((unsigned char)(c))<=0x7f) +#define toascii(c) (((unsigned char)(c))&0x7f) + +static inline unsigned char __tolower(unsigned char c) +{ + if (isupper(c)) + c -= 'A'-'a'; + return c; +} + +static inline unsigned char __toupper(unsigned char c) +{ + if (islower(c)) + c -= 'a'-'A'; + return c; +} + +#define tolower(c) __tolower(c) +#define toupper(c) __toupper(c) + +#endif diff --git a/include/linux/string.h b/include/linux/string.h new file mode 100644 index 0000000..b5497d1 --- /dev/null +++ b/include/linux/string.h @@ -0,0 +1,88 @@ +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +/* We don't want strings.h stuff being user by user stuff by accident */ + +#ifdef __KERNEL__ + +#include /* for size_t */ +#include /* for NULL */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern char * ___strtok; +extern char * strpbrk(const char *,const char *); +extern char * strtok(char *,const char *); +extern char * strsep(char **,const char *); +extern __kernel_size_t strspn(const char *,const char *); + + +/* + * Include machine specific inline routines + */ +#include + +#ifndef __HAVE_ARCH_STRCPY +extern char * strcpy(char *,const char *); +#endif +#ifndef __HAVE_ARCH_STRNCPY +extern char * strncpy(char *,const char *, __kernel_size_t); +#endif +#ifndef __HAVE_ARCH_STRCAT +extern char * strcat(char *, const char *); +#endif +#ifndef __HAVE_ARCH_STRNCAT +extern char * strncat(char *, const char *, __kernel_size_t); +#endif +#ifndef __HAVE_ARCH_STRCMP +extern int strcmp(const char *,const char *); +#endif +#ifndef __HAVE_ARCH_STRNCMP +extern int strncmp(const char *,const char *,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_STRNICMP +extern int strnicmp(const char *, const char *, __kernel_size_t); +#endif +#ifndef __HAVE_ARCH_STRCHR +extern char * strchr(const char *,int); +#endif +#ifndef __HAVE_ARCH_STRRCHR +extern char * strrchr(const char *,int); +#endif +#ifndef __HAVE_ARCH_STRSTR +extern char * strstr(const char *,const char *); +#endif +#ifndef __HAVE_ARCH_STRLEN +extern __kernel_size_t strlen(const char *); +#endif +#ifndef __HAVE_ARCH_STRNLEN +extern __kernel_size_t strnlen(const char *,__kernel_size_t); +#endif + +#ifndef __HAVE_ARCH_MEMSET +extern void * memset(void *,int,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_MEMCPY +extern void * memcpy(void *,const void *,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_MEMMOVE +extern void * memmove(void *,const void *,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_MEMSCAN +extern void * memscan(void *,int,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_MEMCMP +extern int memcmp(const void *,const void *,__kernel_size_t); +#endif +#ifndef __HAVE_ARCH_MEMCHR +extern void * memchr(const void *,int,__kernel_size_t); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif /* _LINUX_STRING_H_ */ diff --git a/include/sa1100.h b/include/sa1100.h index 6a02947..e69de29 100644 --- a/include/sa1100.h +++ b/include/sa1100.h @@ -1,8 +0,0 @@ -/* sa1100.h - dummy for kernel include/asm-arm/arch-sa1100/SA-1100.h */ - -/* make the compiler happy */ -#define __ASM_ARCH_HARDWARE_H - -#include "SA-1100.h" - - diff --git a/tools/Makefile b/tools/Makefile index 83cf654..878747c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -27,14 +27,6 @@ BINS = img2srec mkimage envcrc gen_eth_addr OBJS = img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o -HOSTARCH := $(shell uname -m | \ - sed -e s/i.86/i386/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ \ - -e s/sa110/arm/) - -HOSTOS := $(shell uname -s | tr A-Z a-z) - TOOLSUBDIRS = #