arm: Initial Cubieboard4 work

* SD cards are "blessed" with a boot0 spl and boot1 u-boot
  at fixed locations.
* Allwinner's u-boot is lacking a lot.
* Upstream u-boot should be better at some point. WIP:
  http://lists.denx.de/pipermail/u-boot/2015-January/201537.html
This commit is contained in:
Alexander von Gluck IV
2015-04-11 16:53:04 -05:00
parent 97ebc043a6
commit 9c5e234cb3
5 changed files with 151 additions and 5 deletions
+5
View File
@@ -254,6 +254,11 @@ rule KernelArchitectureSetup architecture
HAIKU_BOOT_PLATFORM ?= u-boot ; HAIKU_BOOT_PLATFORM ?= u-boot ;
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
} }
case cubieboard4 :
{
HAIKU_BOOT_PLATFORM ?= u-boot ;
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
}
case verdex : case verdex :
{ {
HAIKU_BOOT_PLATFORM ?= u-boot ; HAIKU_BOOT_PLATFORM ?= u-boot ;
+64
View File
@@ -0,0 +1,64 @@
# Cubieboard 4 board-specific definitions
# This likely could be easily used for other Allwinner chipsets
HAIKU_BOARD_DESCRIPTION = "Cubieboard 4 (CC-A80)" ;
HAIKU_BOARD_FDT_NAME = "cubieboard4" ;
#
# Various hardcoded addresses
#
# 0x20000000 = SDRAM start
# 0x20007800 = haiku_loader_linux.ub
# 0x20087800 = BASE
HAIKU_BOARD_LOADER_BASE = 0x20087800 ;
HAIKU_BOARD_LOADER_ENTRY_RAW = $(HAIKU_BOARD_LOADER_BASE) ;
HAIKU_BOARD_LOADER_ENTRY_NBSD = `printf \"obase=16;ibase=16;8 + %x\\n\" $(HAIKU_BOARD_LOADER_BASE)|bc` ;
HAIKU_BOARD_LOADER_ENTRY_LINUX = `printf \"obase=16;ibase=16;10 + %x\\n\" $(HAIKU_BOARD_LOADER_BASE)|bc` ;
#
# mmc/SD image
#
# TODO: Update to https://github.com/cubieboard/CC-A80-binaries when accepted upstream
HAIKU_BOARD_FIRMWARE_URL = "https://github.com/kallisti5/CC-A80-binaries/raw/master/bin" ;
# u-boot image
# Dear Cubbieboard, add fdt_addr_r, ramdisk_addr_r, kernel_addr_r to u-boot
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = boot.scr ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "\
fatload mmc 0 0x20800000 haiku-floppyboot.tgz.ub \
fatload mmc 0 0x20007800 haiku_loader_linux.ub \
bootm 0x20007800 0x20800000" ;
HAIKU_BOARD_SDIMAGE_FAT_SIZE = 32 ;
HAIKU_BOARD_SDIMAGE_FILES =
haiku_loader_linux.ub
haiku-floppyboot.tgz.ub
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)
;
HAIKU_BOARD_SDIMAGE_BEGIN = 40950 ; # 512-byte sectors (divisible by 63)
HAIKU_BOARD_SDIMAGE_SIZE = 128 ; # MiB
boot0File = [ DownloadFile sdcard-boot0 : $(HAIKU_BOARD_FIRMWARE_URL)/sdcard-boot0 ] ;
boot1File = [ DownloadFile sdcard-boot1 : $(HAIKU_BOARD_FIRMWARE_URL)/sdcard-boot1 ] ;
# The Allwinner chips require an SD card "blessed" with
# the boot0 SPL and boot1 (u-boot) at a fixed location on
# the SD card. (Dear AW, please support loading from FAT)
HAIKU_BOARD_SDIMAGE_BOOT0_FILE = $(boot0File) ;
HAIKU_BOARD_SDIMAGE_BOOT0_SEEK = 8192 ;
HAIKU_BOARD_SDIMAGE_BOOT1_FILE = $(boot1File) ;
HAIKU_BOARD_SDIMAGE_BOOT1_SEEK = 19554304 ;
#
# gcc flags for the specific cpu
#
local flags = -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard ;
HAIKU_ASFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
HAIKU_CCFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
HAIKU_C++FLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
Vendored
+3 -2
View File
@@ -89,8 +89,8 @@ options:
architecture of the Haiku to build, subsequent architecture of the Haiku to build, subsequent
ones the secondary architectures. ones the secondary architectures.
--target-board <board> ARM only: Specify the board to build for. Must be --target-board <board> ARM only: Specify the board to build for. Must be
one of beagle,rpi1,rpi2,verdex,overo. one of beagle,rpi1,rpi2,cubieboard4,verdex,overo.
--update re-runs last configure invocation [must be given --update re-runs last configure invocation [cubieboard4must be given
as first option!] as first option!]
--use-clang Build with host Clang instead of GCC cross --use-clang Build with host Clang instead of GCC cross
compiler compiler
@@ -485,6 +485,7 @@ supportedTargetBoards="
beagle beagle
rpi1 rpi1
rpi2 rpi2
cubieboard4
verdex verdex
overo overo
" "
@@ -0,0 +1,45 @@
/*
* Copyright 2012-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, [email protected]
*/
#ifndef _BOARD_SUN9I_BOARD_CONFIG_H
#define _BOARD_SUN9I_BOARD_CONFIG_H
// https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/sun9i-a80.dtsi
// http://linux-sunxi.org/A80/Memory_map
#define BOARD_NAME_PRETTY "Allwinner A80"
#define BOARD_CPU_TYPE_ARM7 1
#define BOARD_CPU_A80 1
//#include <arch/arm/sun9i-a80.h>
// For now we just pick up APB1 devices + CPUS
#define DEVICE_BASE 0x07000000
#define DEVICE_SIZE 0x1008FFF
#define VECT_BASE 0xFFFF0000
#define VECT_SIZE SIZE_4K
#define SDRAM_BASE 0x20000000
#define SDRAM_SIZE 0x4000000
// 64Mb (although it is really 0x1FFFFFFFF)
// UART Settings
// snps,dw-apb-uart?
#define BOARD_UART1_BASE 0x07000000
#define BOARD_UART2_BASE BOARD_UART1_BASE + 0x400
#define BOARD_UART3_BASE BOARD_UART2_BASE + 0x400
#define BOARD_UART_DEBUG BOARD_UART1_BASE
#define BOARD_UART_CLOCK 24000000
/* 2.4Mhz */
#endif /* _BOARD_SUN9I_BOARD_CONFIG_H */
+34 -3
View File
@@ -160,11 +160,12 @@ actions BuildUImageScript1
rule BuildUBootSDImage image : files rule BuildUBootSDImage image : files
{ {
Depends $(image) : $(files) ; Depends $(image) : $(files) ;
SDIMAGE_BLOCK_SIZE on $(image) = 1048576 ; # 1M SDIMAGE_BLOCK_SIZE on $(image) = 1048576 ; # 1MiB
SDIMAGE_SIZE on $(image) = $(HAIKU_BOARD_SDIMAGE_SIZE) ;
SDIMAGE_MTOOLS_H on $(image) = 255 ; SDIMAGE_MTOOLS_H on $(image) = 255 ;
SDIMAGE_MTOOLS_S on $(image) = 63 ; SDIMAGE_MTOOLS_S on $(image) = 63 ;
SDIMAGE_MTOOLS_C on $(image) = 8 ; SDIMAGE_MTOOLS_C on $(image) = 8 ;
SDIMAGE_SIZE on $(image) = $(HAIKU_BOARD_SDIMAGE_SIZE) ;
SDIMAGE_BEGIN on $(image) = $(HAIKU_BOARD_SDIMAGE_BEGIN:E=63) ;
BuildUBootSDImage1 $(image) : $(files) ; BuildUBootSDImage1 $(image) : $(files) ;
} }
@@ -183,7 +184,7 @@ actions BuildUBootSDImage1
heads=$(SDIMAGE_MTOOLS_H) sectors=$(SDIMAGE_MTOOLS_S) heads=$(SDIMAGE_MTOOLS_H) sectors=$(SDIMAGE_MTOOLS_S)
mformat_only' > $(1).mtools mformat_only' > $(1).mtools
# partition it # partition it
MTOOLSRC=$(1).mtools mpartition -cI -T 0xc i: MTOOLSRC=$(1).mtools mpartition -b$(SDIMAGE_BEGIN) -cI -T 0xc i:
# format the image # format the image
MTOOLSRC=$(1).mtools mformat -L 32 -v "Haiku" i: MTOOLSRC=$(1).mtools mformat -L 32 -v "Haiku" i:
@@ -201,6 +202,35 @@ actions BuildUBootSDImage1
#cat $(2[0]) >> $(1) #cat $(2[0]) >> $(1)
} }
rule BlessSDImage image
{
# "Blesses" SD cards by writing out data to a fixed point outside of the
# filesystem. Handy if your board needs an SPL or boot0 at a fixed point.
if $(HAIKU_BOARD_SDIMAGE_BOOT0_FILE) {
Depends $(image) : $(HAIKU_BOARD_SDIMAGE_BOOT0_FILE) ;
}
if $(HAIKU_BOARD_SDIMAGE_BOOT1_FILE) {
Depends $(image) : $(HAIKU_BOARD_SDIMAGE_BOOT1_FILE) ;
}
BlessSDImage1 $(image) : $(HAIKU_BOARD_SDIMAGE_BOOT0_FILE) $(HAIKU_BOARD_SDIMAGE_BOOT1_FILE) ;
}
actions BlessSDImage1 bind HAIKU_BOARD_SDIMAGE_BOOT0_SEEK HAIKU_BOARD_SDIMAGE_BOOT1_SEEK
{
if [ $(HAIKU_BOARD_SDIMAGE_BOOT0_SEEK:E=-1) -ge 0 ]; then
dd if=$(2[1]) of=$(1) bs=1 seek=$(HAIKU_BOARD_SDIMAGE_BOOT0_SEEK) conv=notrunc
fi
if [ $(HAIKU_BOARD_SDIMAGE_BOOT1_SEEK:E=-1) -ge 0 ]; then
dd if=$(2[2]) of=$(1) bs=1 seek=$(HAIKU_BOARD_SDIMAGE_BOOT1_SEEK) conv=notrunc
fi
}
# uimage targets # uimage targets
BuildUImage haiku_loader.ub : haiku_loader : BuildUImage haiku_loader.ub : haiku_loader :
-A $(TARGET_ARCH) -O $(uImageFakeOS) -T kernel -C none -A $(TARGET_ARCH) -O $(uImageFakeOS) -T kernel -C none
@@ -250,6 +280,7 @@ Depends haiku-flash-uimage : haiku-$(HAIKU_BOOT_BOARD)_flash_image_uimage.img ;
# SD/mmc image targets # SD/mmc image targets
BuildUBootSDImage haiku-$(HAIKU_BOOT_BOARD).mmc : $(HAIKU_IMAGE) $(HAIKU_BOARD_SDIMAGE_FILES) ; BuildUBootSDImage haiku-$(HAIKU_BOOT_BOARD).mmc : $(HAIKU_IMAGE) $(HAIKU_BOARD_SDIMAGE_FILES) ;
BlessSDImage haiku-$(HAIKU_BOOT_BOARD).mmc ;
NotFile haiku-mmc-image ; NotFile haiku-mmc-image ;
Depends haiku-mmc-image : haiku-$(HAIKU_BOOT_BOARD).mmc ; Depends haiku-mmc-image : haiku-$(HAIKU_BOOT_BOARD).mmc ;