Commit 0be7b52c authored by Henrik Nordstrom's avatar Henrik Nordstrom
Browse files

felboot have been fully merged into sunxi u-boot

parent 3fb12ad2
......@@ -27,15 +27,13 @@ fel:
button at poweron.
usb-boot:
Simple wrapper around felboot and fel to automate USB booting in FEL mode
Simple wrapper to automate USB booting in FEL mode
See http://linux-sunxi.org/FEL/USBBoot for details
fel-gpio:
Simple wrapper around fel-pio and fel to allos GPIO manipulations
via FEL
felboot:
ARM native board initialization for FEL mode
fel-sdboot:
ARM native sdcard bootloader forcing the device into FEL mode
......
CC=gcc
# Target board name. This should match the dram_<boardname>.c in
# u-boot/board/sunxi/
BOARD=cubieboard
# Path/prefix of your tool chain
CROSS_COMPILE=arm-linux-gnueabihf-
# U-boot main source path
UBOOT=$(HOME)/SRC/u-boot/
# U-boot object path (O=... when building u-boot).
UBOOTOBJ=$(UBOOT)build/$(BOARD)/
CFLAGS=-g -O2 -marm -mno-thumb-interwork -mabi=aapcs-linux -march=armv7-a -fno-common -fno-builtin -ffreestanding -ffixed-r8 -msoft-float -D__KERNEL__ -I$(UBOOTOBJ)include2 -I$(UBOOTOBJ)include -I$(UBOOT)include
all: fel-boot-$(BOARD).bin
UBOOT_OBJS= \
spl/arch/arm/cpu/armv7/sunxi/libsunxi.o \
spl/arch/arm/cpu/armv7/libarmv7.o \
spl/arch/arm/lib/libarm.o \
spl/arch/arm/lib/eabi_compat.o \
spl/drivers/power/libpower.o \
spl/drivers/i2c/libi2c.o \
spl/common/libcommon.o \
spl/common/spl/libspl.o \
spl/lib/libgeneric.o \
spl/drivers/serial/libserial.o \
spl/board/sunxi/libsunxi.o
.c.o:
$(CROSS_COMPILE)$(CC) -c $(CFLAGS) $< -o $@
OBJS += main.o
fel-boot-$(BOARD).elf: $(OBJS) $(addprefix $(UBOOTOBJ),$(UBOOT_OBJS))
$(CROSS_COMPILE)$(CC) -Tfel-boot.ld -static -Wl,--gc-sections -nostartfiles -nostdlib $(CFLAGS) -Wl,-Map=$@.map -o $@ $(OBJS) -Wl,--start-group $(addprefix $(UBOOTOBJ),$(UBOOT_OBJS)) -lgcc -Wl,--end-group
fel-boot-$(BOARD).bin: fel-boot-$(BOARD).elf
$(CROSS_COMPILE)objcopy -O binary $< $@
clean:
rm -f *.o *.map *.elf
fel-boot.bin is a FEL bootstrap program.
fel write 0x2000 fel-boot.bin
fel exe 0x2000
fel write 0x4a000000 u-boot.bin
fel exe 0x4a000000
optionally load kernel + initramfs before fel exe of u-boot. The default
environmen looks for a boot script @0x41000000 and sources this if found.
fel write 0x2000 fel-boot.bin
fel exe 0x2000
fel write 0x4a000000 u-boot.bin
fel write 0x41000000 ramboot.scr
fel write 0x43000000 ../script.bin
fel write 0x44000000 ../uImage
fel write 0x4c000000 ../initramfs.img
fel exe 0x4a000000
Build instructions:
0. You need to build u-boot sunxi-current SPL first for the your board.
1. Specify needed configuration when when running make
BOARD= boardname
CROSS_COMPILE= compiler prefix
UBOOT= u-boot sources
UBOOTOBJ= u-boot built tree
make BOARD=cubieboard CROSS_COMPILE=arm-linux-gnueabihf- UBOOT=~/SRC/u-boot/ UBOOTOBJ=~/SRC/u-boot/build/'$(BOARD)'/
Defaults:
# Target board name. This should match the dram_<boardname>.c in
# u-boot/board/sunxi/
BOARD=eoma68
# Path to your tool chain
CROSS_COMPILE=$(HOME)/toolchains/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
# U-boot main source path
UBOOT=$(HOME)/SRC/u-boot/
# U-boot object path (O=... when building u-boot).
UBOOTOBJ=$(UBOOT)build/$(BOARD)/
/*
* (C) Copyright 2007-2011
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
* Tom Cubie <tangliang@allwinnertech.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
*/
#ifndef _SUNXI_CPU_H
#define _SUNXI_CPU_H
#define SUNXI_SRAM_A1_BASE 0X00000000
#define SUNXI_SRAM_A1_SIZE (16 * 1024) /* 16k */
#define SUNXI_SRAM_A2_BASE 0X00004000 /* 16k */
#define SUNXI_SRAM_A3_BASE 0X00008000 /* 13k */
#define SUNXI_SRAM_A4_BASE 0X0000B400 /* 3k */
#if 0
#define SUNXI_SRAM_NAND_BASE 0Xdeaddead /* 2k(address not available on spec) */
#endif
#define SUNXI_SRAM_D_BASE 0X01C00000
#define SUNXI_SRAM_B_BASE 0X01C00000 /* 64k(secure) */
#define SUNXI_SRAMC_BASE 0X01C00000
#define SUNXI_DRAMC_BASE 0X01C01000
#define SUNXI_DMA_BASE 0X01C02000
#define SUNXI_NFC_BASE 0X01C03000
#define SUNXI_TS_BASE 0X01C04000
#define SUNXI_SPI0_BASE 0X01C05000
#define SUNXI_SPI1_BASE 0X01C06000
#define SUNXI_MS_BASE 0X01C07000
#define SUNXI_TVD_BASE 0X01C08000
#define SUNXI_CSI0_BASE 0X01C09000
#define SUNXI_TVE0_BASE 0X01C0A000
#define SUNXI_EMAC_BASE 0X01C0B000
#define SUNXI_LCD0_BASE 0X01C0C000
#define SUNXI_LCD1_BASE 0X01C0D000
#define SUNXI_VE_BASE 0X01C0E000
#define SUNXI_MMC0_BASE 0X01C0F000
#define SUNXI_MMC1_BASE 0X01C10000
#define SUNXI_MMC2_BASE 0X01C11000
#define SUNXI_MMC3_BASE 0X01C12000
#define SUNXI_USB0_BASE 0X01C13000
#define SUNXI_USB1_BASE 0X01C14000
#define SUNXI_SS_BASE 0X01C15000
#define SUNXI_HDMI_BASE 0X01C16000
#define SUNXI_SPI2_BASE 0X01C17000
#define SUNXI_SATA_BASE 0X01C18000
#define SUNXI_PATA_BASE 0X01C19000
#define SUNXI_ACE_BASE 0X01C1A000
#define SUNXI_TVE1_BASE 0X01C1B000
#define SUNXI_USB2_BASE 0X01C1C000
#define SUNXI_CSI1_BASE 0X01C1D000
#define SUNXI_TZASC_BASE 0X01C1E000
#define SUNXI_SPI3_BASE 0X01C1F000
#define SUNXI_CCM_BASE 0X01C20000
#define SUNXI_INTC_BASE 0X01C20400
#define SUNXI_PIO_BASE 0X01C20800
#define SUNXI_TIMER_BASE 0X01C20C00
#define SUNXI_SPDIF_BASE 0X01C21000
#define SUNXI_AC97_BASE 0X01C21400
#define SUNXI_IR0_BASE 0X01C21800
#define SUNXI_IR1_BASE 0X01C21C00
#define SUNXI_IIS_BASE 0X01C22400
#define SUNXI_LRADC_BASE 0X01C22800
#define SUNXI_AD_DA_BASE 0X01C22C00
#define SUNXI_KEYPAD_BASE 0X01C23000
#define SUNXI_TZPC_BASE 0X01C23400
#define SUNXI_SID_BASE 0X01C23800
#define SUNXI_SJTAG_BASE 0X01C23C00
#define SUNXI_TP_BASE 0X01C25000
#define SUNXI_PMU_BASE 0X01C25400
#define SUNXI_UART0_BASE 0X01C28000
#define SUNXI_UART1_BASE 0X01C28400
#define SUNXI_UART2_BASE 0X01C28800
#define SUNXI_UART3_BASE 0X01C28C00
#define SUNXI_UART4_BASE 0X01C29000
#define SUNXI_UART5_BASE 0X01C29400
#define SUNXI_UART6_BASE 0X01C29800
#define SUNXI_UART7_BASE 0X01C29C00
#define SUNXI_PS2_0_BASE 0X01C2A000
#define SUNXI_PS2_1_BASE 0X01C2A400
#define SUNXI_TWI0_BASE 0X01C2AC00
#define SUNXI_TWI1_BASE 0X01C2B000
#define SUNXI_TWI2_BASE 0X01C2B400
#define SUNXI_CAN_BASE 0X01C2BC00
#define SUNXI_SCR_BASE 0X01C2C400
#define SUNXI_GPS_BASE 0X01C30000
#define SUNXI_MALI400_BASE 0X01C40000
#define SUNXI_SRAM_C_BASE 0X01D00000 /* module sram */
#define SUNXI_DE_FE0_BASE 0X01E00000
#define SUNXI_DE_FE1_BASE 0X01E20000
#define SUNXI_DE_BE0_BASE 0X01E60000
#define SUNXI_DE_BE1_BASE 0X01E40000
#define SUNXI_MP_BASE 0X01E80000
#define SUNXI_AVG_BASE 0X01EA0000
#define SUNXI_CSDM_BASE 0X3F500000 /* CoreSight Debug Module*/
#define SUNXI_DDRII_DDRIII_BASE 0X40000000 /* 2G */
#define SUNXI_BROM_BASE 0XFFFF0000 /* 32K */
#define SUNXI_CPU_CFG (SUNXI_TIMER_BASE + 0x13c)
#ifndef __ASSEMBLY__
/* boot type */
typedef enum {
SUNXI_BOOT_TYPE_NULL,
SUNXI_BOOT_TYPE_MMC0,
SUNXI_BOOT_TYPE_NAND,
SUNXI_BOOT_TYPE_MMC2,
SUNXI_BOOT_TYPE_SPI
} sunxi_boot_type_t;
sunxi_boot_type_t get_boot_type(void);
#endif /* __ASSEMBLY__ */
#endif /* _CPU_H */
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(s_init)
SECTIONS
{
. = 0x00002000;
. = ALIGN(4);
.text :
{
*(.text.s_init)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : {
*(.data*)
}
. = ALIGN(4);
. = .;
. = ALIGN(4);
.rel.dyn : {
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
}
.dynsym : {
__dynsym_start = .;
*(.dynsym)
}
. = ALIGN(4);
.note.gnu.build-id :
{
*(.note.gnu.build-id)
}
_end = .;
. = ALIGN(4096);
.mmutable : {
*(.mmutable)
}
.bss_start __rel_dyn_start (OVERLAY) : {
KEEP(*(.__bss_start));
__bss_base = .;
}
.bss __bss_base (OVERLAY) : {
*(.bss*)
. = ALIGN(4);
__bss_limit = .;
}
.bss_end __bss_limit (OVERLAY) : {
KEEP(*(.__bss_end));
}
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
#define __arch_getb(a) (*(volatile unsigned char *)(a))
#define __arch_getw(a) (*(volatile unsigned short *)(a))
#define __arch_getl(a) (*(volatile unsigned int *)(a))
#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
#define dmb() __asm__ __volatile__ ("" : : : "memory")
#define __iormb() dmb()
#define __iowmb() dmb()
#define writeb(v,c) ({ u8 __v = v; __iowmb(); __arch_putb(__v,c); __v; })
#define writew(v,c) ({ u16 __v = v; __iowmb(); __arch_putw(__v,c); __v; })
#define writel(v,c) ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
#define readb(c) ({ u8 __v = __arch_getb(c); __iormb(); __v; })
#define readw(c) ({ u16 __v = __arch_getw(c); __iormb(); __v; })
#define readl(c) ({ u32 __v = __arch_getl(c); __iormb(); __v; })
/*
* (C) Copyright 2013 Henrik Nordstrom <henrik@henriknordstrom.net>
*
* 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
*/
#include <common.h>
int sunxi_mmc_init(void)
{
return -1;
}
void status_led_set(int led, int state)
{
return;
}
# U-boot RAM boot script
ramdisk=
if iminfo 0x4c000000; then
ramdisk=0x4c000000
fi
setenv bootargs console=ttyS0,115200 rdinit=/sbin/init panic=10
bootm 0x44000000 $ramdisk
#!/bin/sh -ex
fel write 0x2000 fel-boot-${1}.bin
fel exe 0x2000
fel write 0x4a000000 ../u-boot.bin
fel exe 0x4a000000
#!/bin/sh -ex
fel write 0x2000 fel-boot-${1}.bin
fel exe 0x2000
fel write 0x4a000000 ../u-boot.bin
fel write 0x43000000 ../script.bin
fel write 0x44000000 ../uImage
fel write 0x4c000000 ../initramfs.img
fel exe 0x4a000000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment