Code buildable with arm1176jzfs, serial works, able to reach pre_init on raspberrypi

This commit is contained in:
Andrzej Flis
2014-12-21 17:03:22 +01:00
parent 191578f645
commit 8d84fd8e3b
35 changed files with 731 additions and 136 deletions

View File

@@ -3,6 +3,6 @@ U_BOOT_BIN_DIR=build/rpi_b
CONSOLE=tty02 CONSOLE=tty02
U_BOOT_SOURCE=git://git.denx.de/u-boot-arm U_BOOT_SOURCE=git://git.denx.de/u-boot-arm
U_BOOT_BRANCH=master U_BOOT_BRANCH=master
U_BOOT_GIT_VERSION=85bafb6da4dddfffa78479aa49a72ae48578a4ce U_BOOT_GIT_VERSION=fce0a90a68de507dc827c1ff40d9e446047fa043
ARCH=evbearmv6hf-el ARCH=evbearmv6hf-el
#ARCH=evbearm-el #ARCH=evbearm-el

View File

@@ -51,7 +51,12 @@ then
cp ../files/minix.h gcc/config/ cp ../files/minix.h gcc/config/
cp ../files/t-minix gcc/config/ cp ../files/t-minix gcc/config/
cp ../files/minix-spec.h gcc/config/ cp ../files/minix-spec.h gcc/config/
if [ "$MACHINE_ARCH" != "earmv6hf" ]
then
cp ../files/arm-minix.h gcc/config/arm/minix.h cp ../files/arm-minix.h gcc/config/arm/minix.h
else
cp ../files/rpi-minix.h gcc/config/arm/minix.h
fi
cp ../files/i386-minix.h gcc/config/i386/minix.h cp ../files/i386-minix.h gcc/config/i386/minix.h
cp ../files/gcov-minix-fs-wrapper.h gcc/ cp ../files/gcov-minix-fs-wrapper.h gcc/
fi fi

150
external/gpl3/gcc/files/rpi-minix.h vendored Normal file
View File

@@ -0,0 +1,150 @@
/* Definitions for ARM running MINIX using the ELF format
Copyright (C) 2001, 2004, 2007 Free Software Foundation, Inc.
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
Adapted for MINIX by Lionel Sambuc <lionel@minix3.org>
This file is part of GCC.
GCC 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 3, or (at your
option) any later version.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#undef MINIX_TARGET_CPU_CPP_BUILTINS
#define MINIX_TARGET_CPU_CPP_BUILTINS() \
do \
{ \
TARGET_BPABI_CPP_BUILTINS(); \
if (ARM_EABI_UNWIND_TABLES) \
builtin_define ("__UNWIND_TABLES__"); \
} \
while (0)
/* Define the actual types of some ANSI-mandated types.
Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
c-common.c, and config/<arch>/<arch>.h. */
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WINT_TYPE
#define WINT_TYPE "int"
/* We don't have any limit on the length as out debugger is GDB. */
#undef DBX_CONTIN_LENGTH
/* NetBSD does its profiling differently to the Acorn compiler. We
don't need a word following the mcount call; and to skip it
requires either an assembly stub or use of fomit-frame-pointer when
compiling the profiling functions. Since we break Acorn CC
compatibility below a little more won't hurt. */
#undef ARM_FUNCTION_PROFILER
#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
{ \
asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
(TARGET_ARM && NEED_PLT_RELOC) \
? "(PLT)" : ""); \
}
/* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
There are consequences you should be aware of...
Normally GCC/arm uses a structure alignment of 32 for compatibility
with armcc. This means that structures are padded to a word
boundary. However this causes problems with bugged NetBSD kernel
code (possibly userland code as well - I have not checked every
binary). The nature of this bugged code is to rely on sizeof()
returning the correct size of various structures rounded to the
nearest byte (SCSI and ether code are two examples, the vm system
is another). This code breaks when the structure alignment is 32
as sizeof() will report a word=rounded size. By changing the
structure alignment to 8. GCC will conform to what is expected by
NetBSD.
This has several side effects that should be considered.
1. Structures will only be aligned to the size of the largest member.
i.e. structures containing only bytes will be byte aligned.
structures containing shorts will be half word aligned.
structures containing ints will be word aligned.
This means structures should be padded to a word boundary if
alignment of 32 is required for byte structures etc.
2. A potential performance penalty may exist if strings are no longer
word aligned. GCC will not be able to use word load/stores to copy
short strings.
This modification is not encouraged but with the present state of the
NetBSD source tree it is currently the only solution that meets the
requirements. */
#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
/* Fixed-sized enum by default (-fno-short-enums) */
#undef MINIX_CC1_SPEC
#define MINIX_CC1_SPEC "%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} "
/* Use by default the new abi and calling standard */
#undef ARM_DEFAULT_ABI
#define ARM_DEFAULT_ABI ARM_ABI_AAPCS
/* LSC: FIXME: When activated, some programs crash on qemu with an illegal
* instruction.
* The cause is unknown (Missing support on MINIX, missing support
* on the emulator, library error...).
*/
#if 0
/* Make sure we use hard-floating point ABI by default */
#undef TARGET_DEFAULT_FLOAT_ABI
#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
#endif
#if defined(NETBSD_NATIVE)
/* LSC: On arm, when compiling statically, we need gcc_eh. */
#undef MINIX_LINK_GCC_C_SEQUENCE_SPEC
#define MINIX_LINK_GCC_C_SEQUENCE_SPEC \
"%{static:--start-group} %G %L -lgcc_eh %{static:--end-group}%{!static:%G}"
#endif /* defined(NETBSD_NATIVE) */
/* Default to full VFP if -mhard-float is specified. */
#undef MINIX_SUBTARGET_ASM_FLOAT_SPEC
#define MINIX_SUBTARGET_ASM_FLOAT_SPEC \
"%{mhard-float:{!mfpu=*:-mfpu=vfp}} \
%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
#undef MINIX_SUBTARGET_EXTRA_ASM_SPEC
#define MINIX_SUBTARGET_EXTRA_ASM_SPEC \
"%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" \
TARGET_FIX_V4BX_SPEC \
"%{fpic|fpie:-k} %{fPIC|fPIE:-k}"
/* Little endian by default */
#undef TARGET_ENDIAN_DEFAULT
#define TARGET_ENDIAN_DEFAULT 0
#undef SUBTARGET_CPU_DEFAULT
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm1176jzfs
#undef TARGET_VERSION
#define TARGET_VERSION fputs (" (MINIX/arm ELF EABI)", stderr);
#undef ARM_EABI_UNWIND_TABLES
#define ARM_EABI_UNWIND_TABLES \
((!USING_SJLJ_EXCEPTIONS && flag_exceptions) || flag_unwind_tables)

View File

@@ -67,12 +67,15 @@
#define MINIX_BOARD_VENDOR_INTEL MINIX_MK_BOARD_VENDOR(1<<0) #define MINIX_BOARD_VENDOR_INTEL MINIX_MK_BOARD_VENDOR(1<<0)
#define MINIX_BOARD_VENDOR_TI MINIX_MK_BOARD_VENDOR(1<<1) #define MINIX_BOARD_VENDOR_TI MINIX_MK_BOARD_VENDOR(1<<1)
#define MINIX_BOARD_VENDOR_BCM MINIX_MK_BOARD_VENDOR(1<<2)
#define MINIX_BOARD_GENERIC MINIX_MK_BOARD(1<<0) #define MINIX_BOARD_GENERIC MINIX_MK_BOARD(1<<0)
/* BeagleBoard XM */ /* BeagleBoard XM */
#define MINIX_BOARD_BBXM MINIX_MK_BOARD(1<<1) #define MINIX_BOARD_BBXM MINIX_MK_BOARD(1<<1)
/* BeagleBone (Black and* white) */ /* BeagleBone (Black and* white) */
#define MINIX_BOARD_BB MINIX_MK_BOARD(1<<2) #define MINIX_BOARD_BB MINIX_MK_BOARD(1<<2)
/* RaspberryPi */
#define MINIX_BOARD_RPI MINIX_MK_BOARD(1<<3)
/* Only one of a kind */ /* Only one of a kind */
#define MINIX_BOARD_VARIANT_GENERIC MINIX_MK_BOARD_VARIANT(1<<0) #define MINIX_BOARD_VARIANT_GENERIC MINIX_MK_BOARD_VARIANT(1<<0)
@@ -80,6 +83,8 @@
#define MINIX_BOARD_VARIANT_BBW MINIX_MK_BOARD_VARIANT(1<<1) #define MINIX_BOARD_VARIANT_BBW MINIX_MK_BOARD_VARIANT(1<<1)
/* BeagleBone Black */ /* BeagleBone Black */
#define MINIX_BOARD_VARIANT_BBB MINIX_MK_BOARD_VARIANT(1<<2) #define MINIX_BOARD_VARIANT_BBB MINIX_MK_BOARD_VARIANT(1<<2)
/* RaspberryPi B+ */
#define MINIX_BOARD_VARIANT_RPIBP MINIX_MK_BOARD_VARIANT(1<<3)
#define BOARD_ID_INTEL \ #define BOARD_ID_INTEL \
( MINIX_BOARD_ARCH_X86 \ ( MINIX_BOARD_ARCH_X86 \
@@ -113,11 +118,22 @@
| MINIX_BOARD_VARIANT_BBB\ | MINIX_BOARD_VARIANT_BBB\
) )
#define BOARD_ID_RPI \
( MINIX_BOARD_ARCH_ARM \
| MINIX_BOARD_ARCH_VARIANT_ARM_ARMV6 \
| MINIX_BOARD_VENDOR_BCM \
| MINIX_BOARD_RPI \
| MINIX_BOARD_VARIANT_RPIBP \
)
#define BOARD_IS_BBXM(v) \ #define BOARD_IS_BBXM(v) \
( (BOARD_ID_BBXM & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK)) ( (BOARD_ID_BBXM & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
/* Either one of the known BeagleBones */ /* Either one of the known BeagleBones */
#define BOARD_IS_BB(v) \ #define BOARD_IS_BB(v) \
( (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK)) ( (BOARD_ID_BBW & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
/* RaspberryPI B+ board*/
#define BOARD_IS_RPI(v) \
( (BOARD_ID_RPI & ~MINIX_BOARD_VARIANT_MASK) == (v & ~MINIX_BOARD_VARIANT_MASK))
#define BOARD_IS_BBW(v) ( v == BOARD_ID_BBW) #define BOARD_IS_BBW(v) ( v == BOARD_ID_BBW)
#define BOARD_IS_BBB(v) ( v == BOARD_ID_BBB) #define BOARD_IS_BBB(v) ( v == BOARD_ID_BBB)
@@ -148,6 +164,7 @@ static struct shortname2id shortname2id[] = {
{.name = "BBXM",.id = BOARD_ID_BBXM}, {.name = "BBXM",.id = BOARD_ID_BBXM},
{.name = "A335BONE",.id = BOARD_ID_BBW}, {.name = "A335BONE",.id = BOARD_ID_BBW},
{.name = "A335BNLT",.id = BOARD_ID_BBB}, {.name = "A335BNLT",.id = BOARD_ID_BBB},
{.name = "RPIBPL",.id = BOARD_ID_RPI},
}; };
struct board_id2name struct board_id2name
@@ -162,6 +179,7 @@ static struct board_id2name board_id2name[] = {
{.id = BOARD_ID_BBXM,.name = "ARM-ARMV7-TI-BBXM-GENERIC"}, {.id = BOARD_ID_BBXM,.name = "ARM-ARMV7-TI-BBXM-GENERIC"},
{.id = BOARD_ID_BBW,.name = "ARM-ARMV7-TI-BB-WHITE"}, {.id = BOARD_ID_BBW,.name = "ARM-ARMV7-TI-BB-WHITE"},
{.id = BOARD_ID_BBB,.name = "ARM-ARMV7-TI-BB-BLACK"}, {.id = BOARD_ID_BBB,.name = "ARM-ARMV7-TI-BB-BLACK"},
{.id = BOARD_ID_RPI,.name = "ARM-ARMV6-BCM-RPI-BPLUS"},
}; };
struct board_arch2arch struct board_arch2arch

View File

@@ -55,7 +55,7 @@ CPPFLAGS.subr_prf.c+= -Dputchar=kputc
# Activate optional support, may be deactivated. # Activate optional support, may be deactivated.
CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPORT CPPFLAGS.subr_prf.c+= -DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPORT
.include "bsp/ti/Makefile.inc" .include "bsp/rpi/Makefile.inc"
# some object files we give a symbol prefix (or namespace) of __k_unpaged_ # some object files we give a symbol prefix (or namespace) of __k_unpaged_
# that must live in their own unique namespace. # that must live in their own unique namespace.

View File

@@ -26,7 +26,7 @@
void void
halt_cpu(void) halt_cpu(void)
{ {
asm volatile("dsb"); asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory");
asm volatile("cpsie i"); asm volatile("cpsie i");
asm volatile("wfi"); asm volatile("wfi");
asm volatile("cpsid i"); asm volatile("cpsid i");

View File

@@ -0,0 +1,13 @@
#
# BSP for RPI hardware
#
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/bsp/rpi
.for unpaged_obj in rpi_serial.o rpi_rtc.o rpi_reset.o
BSP_OBJS_UNPAGED += ${unpaged_obj}
.endfor
SRCS+= rpi_init.c rpi_serial.c rpi_timer.c rpi_padconf.c rpi_intr.c rpi_rtc.c \
rpi_reset.c

View File

@@ -1,7 +1,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "bsp_init.h" #include "bsp_init.h"
#include "bsp_padconf.h" #include "bsp_padconf.h"
#include "omap_rtc.h" #include "rpi_rtc.h"
#include "bsp_reset.h" #include "bsp_reset.h"
void void

View File

@@ -11,7 +11,7 @@
#include "arch_proto.h" #include "arch_proto.h"
#include "hw_intr.h" #include "hw_intr.h"
#include "omap_intr_registers.h" #include "rpi_intr_registers.h"
static struct omap_intr static struct omap_intr
{ {
vir_bytes base; vir_bytes base;

View File

@@ -12,8 +12,8 @@
#include "arch_proto.h" #include "arch_proto.h"
#include "bsp_reset.h" #include "bsp_reset.h"
#include "omap_timer_registers.h" #include "rpi_timer_registers.h"
#include "omap_rtc.h" #include "rpi_rtc.h"
#define AM335X_CM_BASE 0x44E00000 #define AM335X_CM_BASE 0x44E00000
#define AM335X_CM_SIZE 0x1000 #define AM335X_CM_SIZE 0x1000

View File

@@ -17,7 +17,7 @@
#include "kernel/vm.h" #include "kernel/vm.h"
#include "kernel/proto.h" #include "kernel/proto.h"
#include "arch_proto.h" #include "arch_proto.h"
#include "omap_rtc.h" #include "rpi_rtc.h"
#define RTC_SS_BASE 0x44e3e000 #define RTC_SS_BASE 0x44e3e000
#define RTC_SS_SIZE 0x1000 #define RTC_SS_SIZE 0x1000

View File

@@ -11,22 +11,22 @@
#include "kernel/proto.h" #include "kernel/proto.h"
#include "arch_proto.h" #include "arch_proto.h"
#include "omap_serial.h" #include "rpi_serial.h"
struct omap_serial struct rpi_serial
{ {
vir_bytes base; vir_bytes base;
vir_bytes size; vir_bytes size;
}; };
static struct omap_serial omap_serial = { static struct rpi_serial rpi_serial = {
.base = 0, .base = 0,
}; };
static kern_phys_map serial_phys_map; static kern_phys_map serial_phys_map;
/* /*
* In kernel serial for the omap. The serial driver like most other * In kernel serial for the rpi. The serial driver like most other
* drivers needs to be started early and even before the MMU is turned on. * drivers needs to be started early and even before the MMU is turned on.
* We start by directly accessing the hardware memory address. Later on * We start by directly accessing the hardware memory address. Later on
* a when the MMU is turned on we still use a 1:1 mapping for these addresses. * a when the MMU is turned on we still use a 1:1 mapping for these addresses.
@@ -45,40 +45,32 @@ static kern_phys_map serial_phys_map;
void void
bsp_ser_init() bsp_ser_init()
{ {
if (BOARD_IS_BBXM(machine.board_id)) { /*if (BOARD_IS_RPI(machine.board_id))
omap_serial.base = OMAP3_DM37XX_DEBUG_UART_BASE; {
} else if (BOARD_IS_BB(machine.board_id)) { rpi_serial.base = RPI_BCM2835_DEBUG_UART_BASE;
omap_serial.base = OMAP3_AM335X_DEBUG_UART_BASE; }*/
} rpi_serial.base = RPI_BCM2835_DEBUG_UART_BASE;
omap_serial.size = 0x1000; /* 4k */ rpi_serial.size = 0x1000; /* 4k */
kern_phys_map_ptr(omap_serial.base, omap_serial.size, kern_phys_map_ptr(rpi_serial.base, rpi_serial.size,
VMMF_UNCACHED | VMMF_WRITE, &serial_phys_map, VMMF_UNCACHED | VMMF_WRITE, &serial_phys_map,
(vir_bytes) & omap_serial.base); (vir_bytes) & rpi_serial.base);
assert(omap_serial.base); assert(rpi_serial.base);
} }
void void
bsp_ser_putc(char c) bsp_ser_putc(char c)
{ {
int i; int i;
assert(omap_serial.base); assert(rpi_serial.base);
/* Wait until there is space in the FIFO */
/* Wait until FIFO's empty */ /* Wait until FIFO's empty */
for (i = 0; i < 100000; i++) { while ( mmio_read(rpi_serial.base + RPI_UART_FR) & RPI_UARTFR_TXFF );
if (mmio_read(omap_serial.base + OMAP3_LSR) & OMAP3_LSR_THRE) {
break;
}
}
/* Write character */ /* Write character */
mmio_write(omap_serial.base + OMAP3_THR, c); mmio_write(rpi_serial.base + RPI_UART_DR, c);
/* And wait again until FIFO's empty to prevent TTY from overwriting */ /* Wait until FIFO's empty */
for (i = 0; i < 100000; i++) { while ( mmio_read(rpi_serial.base + RPI_UART_FR) & RPI_UARTFR_TXFF );
if (mmio_read(omap_serial.base +
OMAP3_LSR) & (OMAP3_LSR_THRE | OMAP3_LSR_TEMT)) {
break;
}
}
} }

View File

@@ -0,0 +1,31 @@
#ifndef _RPI_SERIAL_H
#define _RPI_SERIAL_H
/* UART register map */
//#define OMAP3_DM37XX_DEBUG_UART_BASE 0x49020000 /* UART3 physical address */
//#define OMAP3_AM335X_DEBUG_UART_BASE 0x44E09000 /* UART0? physical address */
#define RPI_BCM2835_DEBUG_UART_BASE 0x20201000 /* miniUART - uses PL011 module */
/* UART registers */
//#define OMAP3_THR 0x000 /* Transmit holding register */
//#define OMAP3_LSR 0x014 /* Line status register */
//#define OMAP3_SSR 0x044 /* Supplementary status register */
#define RPI_UART_DR 0 // data register
#define RPI_UART_FR 0x18 // flag register
/* Line status register fields */
//#define OMAP3_LSR_TEMT 0x40 /* Transmitter empty */
//#define OMAP3_LSR_THRE 0x20 /* Transmit-hold-register empty */
#define RPI_UARTFR_TXFF (1 << 5) // tramit FIFO full
/* Supplementary status register fields */
//#define OMAP3_SSR_TX_FIFO_FULL (1 << 0) /* Transmit FIFO full */
#ifndef __ASSEMBLY__
void omap3_ser_init();
void omap3_ser_putc(char c);
#endif /* __ASSEMBLY__ */
#endif /* _RPI_SERIAL_H */

View File

@@ -10,8 +10,8 @@
#include <stdio.h> #include <stdio.h>
#include "arch_proto.h" #include "arch_proto.h"
#include "bsp_timer.h" #include "bsp_timer.h"
#include "omap_timer_registers.h" #include "rpi_timer_registers.h"
#include "omap_intr_registers.h" #include "rpi_intr_registers.h"
#include "bsp_intr.h" #include "bsp_intr.h"
/* interrupt handler hook */ /* interrupt handler hook */

View File

@@ -1,13 +0,0 @@
#
# BSP for TI hardware
#
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/bsp/ti
.for unpaged_obj in omap_serial.o omap_rtc.o omap_reset.o
BSP_OBJS_UNPAGED += ${unpaged_obj}
.endfor
SRCS+= omap_init.c omap_serial.c omap_timer.c omap_padconf.c omap_intr.c omap_rtc.c \
omap_reset.c

View File

@@ -1,27 +0,0 @@
#ifndef _OMAP_SERIAL_H
#define _OMAP_SERIAL_H
/* UART register map */
#define OMAP3_DM37XX_DEBUG_UART_BASE 0x49020000 /* UART3 physical address */
#define OMAP3_AM335X_DEBUG_UART_BASE 0x44E09000 /* UART0? physical address */
/* UART registers */
#define OMAP3_THR 0x000 /* Transmit holding register */
#define OMAP3_LSR 0x014 /* Line status register */
#define OMAP3_SSR 0x044 /* Supplementary status register */
/* Line status register fields */
#define OMAP3_LSR_TEMT 0x40 /* Transmitter empty */
#define OMAP3_LSR_THRE 0x20 /* Transmit-hold-register empty */
/* Supplementary status register fields */
#define OMAP3_SSR_TX_FIFO_FULL (1 << 0) /* Transmit FIFO full */
#ifndef __ASSEMBLY__
void omap3_ser_init();
void omap3_ser_putc(char c);
#endif /* __ASSEMBLY__ */
#endif /* _OMAP_SERIAL_H */

View File

@@ -31,7 +31,8 @@ multiboot_init:
ldr sp, =load_stack_start /* make usable stack */ ldr sp, =load_stack_start /* make usable stack */
mov fp, #0 mov fp, #0
bl _C_LABEL(pre_init) bl _C_LABEL(pre_init)
b hang
/*b multiboot_init*/
/* Kernel is mapped high now and ready to go, with /* Kernel is mapped high now and ready to go, with
* the boot info pointer returned by pre_init in r0. * the boot info pointer returned by pre_init in r0.
* Set the highly mapped stack and initialize it. * Set the highly mapped stack and initialize it.

View File

@@ -21,19 +21,19 @@ static inline void check_int(unsigned int state, int line)
/* Data memory barrier */ /* Data memory barrier */
static inline void dmb(void) static inline void dmb(void)
{ {
asm volatile("dmb" : : : "memory"); asm volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
} }
/* Data synchronization barrier */ /* Data synchronization barrier */
static inline void dsb(void) static inline void dsb(void)
{ {
asm volatile("dsb" : : : "memory"); asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory");
} }
/* Instruction synchronization barrier */ /* Instruction synchronization barrier */
static inline void isb(void) static inline void isb(void)
{ {
asm volatile("isb" : : : "memory"); asm volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory");
} }
static inline void barrier(void) static inline void barrier(void)

View File

@@ -1,8 +1,8 @@
OUTPUT_ARCH("arm") OUTPUT_ARCH("arm")
ENTRY(__k_unpaged_MINIX) ENTRY(__k_unpaged_MINIX)
_kern_phys_base = 0x80200000; /* phys 4MB aligned for convenient remapping */ _kern_phys_base = 0x00008000;
_kern_vir_base = 0xF0400000; /* map kernel high for max. user vir space */ _kern_vir_base = 0xc0008000; /* map kernel high for max. user vir space */
_kern_offset = (_kern_vir_base - _kern_phys_base); _kern_offset = (_kern_vir_base - _kern_phys_base);
__k_unpaged__kern_offset = _kern_offset; __k_unpaged__kern_offset = _kern_offset;

View File

@@ -386,27 +386,30 @@ kinfo_t *pre_init(int argc, char **argv)
* arguments. by convention the second argument is the * arguments. by convention the second argument is the
* command line */ * command line */
if (argc != 2) { if (argc != 2) {
POORMANS_FAILURE_NOTIFICATION; //POORMANS_FAILURE_NOTIFICATION;
} }
bootargs = argv[1]; //bootargs = argv[1];
set_machine_id(bootargs); //set_machine_id(bootargs);
bsp_ser_init(); bsp_ser_init();
bsp_ser_putc('t');
bsp_ser_putc('a');
bsp_ser_putc('k');
/* Get our own copy boot params pointed to by ebx. /* Get our own copy boot params pointed to by ebx.
* Here we find out whether we should do serial output. * Here we find out whether we should do serial output.
*/ */
get_parameters(&kinfo, bootargs); //get_parameters(&kinfo, bootargs);
/* Make and load a pagetable that will map the kernel /* Make and load a pagetable that will map the kernel
* to where it should be; but first a 1:1 mapping so * to where it should be; but first a 1:1 mapping so
* this code stays where it should be. * this code stays where it should be.
*/ */
dcache_clean(); /* clean the caches */ //dcache_clean(); /* clean the caches */
pg_clear(); //pg_clear();
pg_identity(&kinfo); //pg_identity(&kinfo);
kinfo.freepde_start = pg_mapkernel(); //kinfo.freepde_start = pg_mapkernel();
pg_load(); //pg_load();
vm_enable_paging(); //vm_enable_paging();
/* Done, return boot info so it can be passed to kmain(). */ /* Done, return boot info so it can be passed to kmain(). */
return &kinfo; return &kinfo;

View File

@@ -75,10 +75,10 @@ MODDIR=${DESTDIR}/boot/minix/.temp
# for alignment reasons, prefer sizes which are multiples of 4096 bytes # for alignment reasons, prefer sizes which are multiples of 4096 bytes
# #
: ${IMG_SIZE=$(( 2*(2**30) / 512))} : ${IMG_SIZE=$(( 2*(2**30) / 512))}
: ${FAT_SIZE=$(( 10*(2**20) / 512))} : ${FAT_SIZE=$(( 15*(2**20) / 512))}
: ${ROOT_SIZE=$(( 64*(2**20) / 512))} : ${ROOT_SIZE=$(( 64*(2**20) / 512))}
: ${HOME_SIZE=$(( 128*(2**20) / 512))} : ${HOME_SIZE=$(( 128*(2**20) / 512))}
: ${USR_SIZE=$(( 1792*(2**20) / 512))} : ${USR_SIZE=$(( 1787*(2**20) / 512))}
# #
# Do some math to determine the start addresses of the partitions. # Do some math to determine the start addresses of the partitions.
@@ -245,12 +245,29 @@ ${MKFS_VFAT_CMD} ${MKFS_VFAT_OPTS} ${IMG_DIR}/fat.img
# -c set console e.g. tty02 or tty00 # -c set console e.g. tty02 or tty00
# -v set verbosity e.g. 0 to 3 # -v set verbosity e.g. 0 to 3
#${RELEASETOOLSDIR}/gen_uEnv.txt.sh -c ${CONSOLE} -n -p bb/ > ${IMG_DIR}/uEnv.txt #${RELEASETOOLSDIR}/gen_uEnv.txt.sh -c ${CONSOLE} -n -p bb/ > ${IMG_DIR}/uEnv.txt
${RELEASETOOLSDIR}/gen_uEnv.txt.sh -c ${CONSOLE} > ${IMG_DIR}/uEnv.txt
echo "Copying configuration kernel and boot modules" echo "Copying configuration kernel and boot modules"
#mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$MLO ::MLO ${RELEASETOOLSDIR}/gen_uEnv.txt.sh -c ${CONSOLE} -a ${ARCH} > ${IMG_DIR}/textfile.txt
case $ARCH in
evbearm-el)
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$MLO ::MLO
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/textfile.txt ::uEnv.txt
;;
evbearmv6hf-el)
#copy rpi FW
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/bootcode.bin ::bootcode.bin
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/fixup_cd.dat ::fixup_cd.dat
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/fixup_x.dat ::fixup_x.dat
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/fixup.dat ::fixup.dat
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/start_cd.elf ::start_cd.elf
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/start_x.elf ::start_x.elf
mcopy -bsp -i ${IMG_DIR}/fat.img ${RELEASETOOLSDIR}/fw/rpi/start.elf ::start.elf
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/textfile.txt ::config.txt
;;
esac
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$UBOOT ::u-boot.img mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$UBOOT ::u-boot.img
mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/uEnv.txt ::uEnv.txt
# #
# Do some last processing of the kernel and servers and then put them on the FAT # Do some last processing of the kernel and servers and then put them on the FAT
@@ -281,7 +298,7 @@ done
# #
# For tftp booting # For tftp booting
# #
cp ${IMG_DIR}/uEnv.txt ${OBJ}/ cp ${IMG_DIR}/textfile.txt ${OBJ}/
# #
# Create the empty image where we later will put the partitions in. # Create the empty image where we later will put the partitions in.

View File

@@ -0,0 +1,356 @@
NOTE! This copyright does *not* cover user programs that use kernel
services by normal system calls - this is merely considered normal use
of the kernel, and does *not* fall under the heading of "derived work".
Also note that the GPL below is copyrighted by the Free Software
Foundation, but the instance of code that it refers to (the Linux
kernel) is copyrighted by me and others who actually wrote it.
Also note that the only valid version of the GPL as far as the kernel
is concerned is _this_ particular version of the license (ie v2, not
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
Linus Torvalds
----------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,29 @@
Copyright (c) 2006, Broadcom Corporation.
All rights reserved.
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:
* This software may only be used for the purposes of developing for,
running or using a Raspberry Pi device.
* Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of Broadcom Corporation nor the names of its suppliers
may be used to endorse or promote products derived from this software
without specific prior written permission.
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -14,24 +14,67 @@ list="0x80200000 kernel.bin
0x86800000 pfs.elf 0x86800000 pfs.elf
0x87000000 init.elf" 0x87000000 init.elf"
####################
fill_cmd() {
#load == load method like fatload mmc 0:1
#prefix is an optional directory containing the ending /
load=$1
prefix=$2
export IFS=" "
echo $list | while true
do
if ! read -r mem addr
then
break
fi
#e.g. ; fatloat mmc 0:1 0x82000000 mydir/ds.elf
echo -n "; $load $mem $prefix$addr"
done
}
fill_uEnvFile()
{
echo "# Set the command to be executed"
echo "uenvcmd=run $BOOT"
echo "bootargs=console=$CONSOLE rootdevname=c0d0p1 verbose=$VERBOSE hz=$HZ"
echo
echo 'bootminix=setenv bootargs \$bootargs board_name=\$board_name ; echo \$bootargs; go 0x80200000 \\\"$bootargs\\\"'
echo
echo "mmcbootcmd=echo starting from MMC ; mmc part 0; $(fill_cmd "fatload mmc 0:1" "") ; run bootminix"
echo
echo "# Netbooting."
echo "serverip=192.168.12.10"
echo "ipaddr=192.168.12.62"
echo "usbnet_devaddr=e8:03:9a:24:f9:10"
echo "usbethaddr=e8:03:9a:24:f9:11"
echo "netbootcmd=echo starting from TFTP; $(fill_cmd "tftp" "$NETBOOT_PREFIX") ; run bootminix"
exit 0
}
fill_CmdFile()
{
echo "kernel=u-boot.img"
exit 0
}
# #
# PREFIX for loading file over tftp to allow hosting multiple # PREFIX for loading file over tftp to allow hosting multiple
# version/devices. # version/devices.
NETBOOT_PREFIX="" NETBOOT_PREFIX=""
NETBOOT="no" NETBOOT="no"
BOOT="mmcbootcmd" BOOT="mmcbootcmd"
#default for the beagleboard-xM #default for the beagleboard-xM
CONSOLE=tty02 CONSOLE=tty02
#verbosity #verbosity
VERBOSE=0 VERBOSE=0
HZ=1000 HZ=1000
ARCH=evbearm-el
while getopts "c:v:h:p:n?" c while getopts "c:v:h:p:n:a:?" c
do do
case "$c" in case "$c" in
\?) \?)
echo "Usage: $0 [-p netboot_prefix] -n [-c consoletty] [-v level] " >&2 echo "Usage: $0 [-p netboot_prefix] -n [-c consoletty] [-v level] [-a architecture]" >&2
exit 1 exit 1
;; ;;
n) n)
@@ -52,39 +95,16 @@ do
# system hz # system hz
HZ=$OPTARG HZ=$OPTARG
;; ;;
a)
ARCH=$OPTARG
esac esac
done done
fill_cmd() { if [ "$ARCH" == "evbearm-el" ]
#load == load method like fatload mmc 0:1
#prefix is an optional directory containing the ending /
load=$1
prefix=$2
export IFS=" "
echo $list | while true
do
if ! read -r mem addr
then then
break fill_uEnvFile
elif [ "$ARCH" == "evbearmv6hf-el" ]
then
fill_CmdFile
fi fi
#e.g. ; fatloat mmc 0:1 0x82000000 mydir/ds.elf
echo -n "; $load $mem $prefix$addr"
done
}
echo "# Set the command to be executed"
echo "uenvcmd=run $BOOT"
echo "bootargs=console=$CONSOLE rootdevname=c0d0p1 verbose=$VERBOSE hz=$HZ"
echo
echo 'bootminix=setenv bootargs \$bootargs board_name=\$board_name ; echo \$bootargs; go 0x80200000 \\\"$bootargs\\\"'
echo
echo "mmcbootcmd=echo starting from MMC ; mmc part 0; $(fill_cmd "fatload mmc 0:1" "") ; run bootminix"
echo
echo "# Netbooting."
echo "serverip=192.168.12.10"
echo "ipaddr=192.168.12.62"
echo "usbnet_devaddr=e8:03:9a:24:f9:10"
echo "usbethaddr=e8:03:9a:24:f9:11"
echo "netbootcmd=echo starting from TFTP; $(fill_cmd "tftp" "$NETBOOT_PREFIX") ; run bootminix"
exit 0