platform/u-boot: Build all fdt's and include in u-boot mmc

* Eventually BoardSetups and target boards will go away.
* Include all known fdt's in the mmc image
* This gets us closer to target board-less arm
* Changing hardware is as simple as plugging a new fdt
  into u-boot's startup script.
* Drop my original rpi1 work.  We're targetting ARMv7
  minimum.
This commit is contained in:
Alexander von Gluck IV 2017-07-09 22:19:51 -05:00
parent acfd5c8676
commit 855fc5a0d3
12 changed files with 25 additions and 162 deletions

View File

@ -254,11 +254,6 @@ rule KernelArchitectureSetup architecture
HAIKU_BOOT_PLATFORM ?= u-boot ;
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
}
case rpi1 :
{
HAIKU_BOOT_PLATFORM ?= u-boot ;
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
}
case rpi2 :
{
HAIKU_BOOT_PLATFORM ?= u-boot ;

View File

@ -58,7 +58,7 @@ ubootFile = [ DownloadFile $(HAIKU_BOARD_UBOOT_IMAGE)
# it to the proper location. Our image is smaller than 2MB so this works.
#HAIKU_BOARD_SDIMAGE_UBOOT_UENV_NAME = uEnv.txt ;
HAIKU_BOARD_SDIMAGE_UBOOT_UENV = "uenvcmd=run loadImage; run mmcboot; \
loadImage=fatload mmc0 0 $(HAIKU_BOARD_LOADER_UIBASE) haiku_loader_linux.ub; fatload mmc 0 0x80100000 $(HAIKU_BOARD_FDT_NAME).dtb; fatload mmc 0 0x81200000 haiku-floppyboot.tgz.ub; \
loadImage=fatload mmc0 0 $(HAIKU_BOARD_LOADER_UIBASE) haiku_loader_linux.ub; fatload mmc 0 0x80100000 /fdt/$(HAIKU_BOARD_FDT_NAME).dtb; fatload mmc 0 0x81200000 haiku-floppyboot.tgz.ub; \
mmcboot=bootm $(HAIKU_BOARD_LOADER_UIBASE) 0x81200000 0x80100000" ;
HAIKU_BOARD_SDIMAGE_FILES =
@ -67,7 +67,6 @@ HAIKU_BOARD_SDIMAGE_FILES =
haiku_loader_nbsd.ub
haiku_loader_linux.ub
haiku-floppyboot.tgz.ub
$(HAIKU_BOARD_FDT_NAME).dtb
;

View File

@ -36,7 +36,7 @@ ubootFile = [ DownloadFile u-boot.img : $(HAIKU_BOARD_UBOOT_IMAGE_URL)/u-boot.im
# U-Boot environment
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = boot.scr ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "\
fatload mmc 0 ${fdt_addr_r} $(HAIKU_BOARD_FDT_NAME).dtb \
fatload mmc 0 ${fdt_addr_r} /fdt/$(HAIKU_BOARD_FDT_NAME).dtb \
fdt addr ${fdt_addr_r} \
fatload mmc 0 ${ramdisk_addr_r} haiku-floppyboot.tgz.ub \
fatload mmc 0 ${kernel_addr_r} haiku_loader_linux.ub \
@ -45,7 +45,6 @@ fatload mmc 0 ${fdt_addr_r} $(HAIKU_BOARD_FDT_NAME).dtb \
HAIKU_BOARD_SDIMAGE_FILES =
$(mloFile)
$(ubootFile)
$(HAIKU_BOARD_FDT_NAME).dtb
haiku_loader_linux.ub
haiku-floppyboot.tgz.ub
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)

View File

@ -72,7 +72,7 @@ HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = boot.scr ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "\
setenv bootargs debug_screen true; \
if mmc rescan; then \
fatload mmc 0 0x80100000 $(HAIKU_BOARD_FDT_NAME).dtb ; \
fatload mmc 0 0x80100000 /fdt/$(HAIKU_BOARD_FDT_NAME).dtb ; \
fatload mmc 0 0x81200000 haiku-floppyboot.tgz.ub; \
fatload mmc 0 $(HAIKU_BOARD_LOADER_UIBASE) haiku_loader_linux.ub; \
bootm $(HAIKU_BOARD_LOADER_UIBASE) 0x81200000 0x80100000; \
@ -86,7 +86,6 @@ HAIKU_BOARD_SDIMAGE_FILES =
haiku_loader_linux.ub
haiku_loader_nbsd.ub
haiku-floppyboot.tgz.ub
$(HAIKU_BOARD_FDT_NAME).dtb
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)
;

View File

@ -1,66 +0,0 @@
# Raspberry Pi board-specific definitions
HAIKU_BOARD_DESCRIPTION = "Raspberry Pi" ;
HAIKU_BOOT_PLATFORM = u-boot ;
#
# Various hardcoded addresses
#
HAIKU_BOARD_LOADER_BASE = 0x00080000 ;
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` ;
HAIKU_BOARD_BOOT_ARCHIVE_BASE = 0x02100000 ;
HAIKU_BOARD_BOOT_ARCHIVE_SIZE = 0x00400000 ;
# TODO: needs to be configured in the config.txt
# ramfsfile=haiku-floppyboot.tgz and ramfsaddr=x
#
# Flash image
#
# N/A for Raspberry Pi
#
# mmc/SD image
#
HAIKU_BOARD_FIRMWARE_URL = http://github.com/raspberrypi/firmware/raw/master/boot/ ;
HAIKU_BOARD_FIRMWARE_FILES =
bootcode.bin
loader.bin
arm224_start.elf # start.elf
LICENSE.broadcom
;
# in MB
HAIKU_BOARD_SDIMAGE_FAT_SIZE = 32 ;
HAIKU_BOARD_SDIMAGE_FAT_FILES =
$(HAIKU_BOARD_FIRMWARE_FILES)
haiku_loader
;
# in MB
HAIKU_BOARD_SDIMAGE_SIZE = 256 ;
#
# gcc flags for the specific cpu
#
local flags = -mtune=arm1176jzf-s -march=armv6 ;
HAIKU_ASFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
HAIKU_CCFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
HAIKU_C++FLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
# Workaround for ld using 32k for alignment despite forcing it in the config...
# should definitely not be needed!
HAIKU_KERNEL_LINKFLAGS +=
-Wl,-z -Wl,max-page-size=0x1000
-Wl,-z -Wl,common-page-size=0x1000 ;
HAIKU_LINKFLAGS_$(HAIKU_PACKAGING_ARCH) +=
-Wl,-z -Wl,max-page-size=0x1000
-Wl,-z -Wl,common-page-size=0x1000 ;

View File

@ -1,25 +0,0 @@
##### CPU Speed
#arm_freq 700
##### Memory layout
#gpu_mem 64
# Memory based on model.. overrides gpu_mem
#gpu_mem_256 64
#gpu_mem_512 64
##### Low level
kernel=haiku_loader
kernel_address=0x0
ramfsfile=haiku-floppyboot.tgz
ramfsaddr=0x04000000
# Skip boot tags for non-linux platforms
disable_commandline_tags=1
#device_tree=bcm2835.dtb
#device_tree_address=0x100
##### UART Settings
# Default is 115200
#init_uart_baud=9600
#init_uart_clock=

View File

@ -35,7 +35,7 @@ HAIKU_BOARD_FIRMWARE_FILES =
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = boot.scr ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "\
fatload mmc 0 ${fdt_addr_r} $(HAIKU_BOARD_FDT_NAME).dtb \
fatload mmc 0 ${fdt_addr_r} /fdt/$(HAIKU_BOARD_FDT_NAME).dtb \
fdt addr ${fdt_addr_r} \
fatload mmc 0 ${ramdisk_addr_r} haiku-floppyboot.tgz.ub \
fatload mmc 0 ${kernel_addr_r} haiku_loader_linux.ub \
@ -45,7 +45,6 @@ HAIKU_BOARD_SDIMAGE_FAT_SIZE = 32 ;
HAIKU_BOARD_SDIMAGE_FILES =
$(HAIKU_BOARD_FIRMWARE_FILES)
$(configFile)
$(HAIKU_BOARD_FDT_NAME).dtb
$(ubootFile)
haiku_loader_linux.ub
haiku-floppyboot.tgz.ub

3
configure vendored
View File

@ -85,7 +85,7 @@ options:
ones the secondary architectures.
--target-board <board> ARM only: Target board to build for.
<board> is one of: "beagleboard","beaglebone",
"rpi1","rpi2","cubieboard4","verdex","overo"
"rpi2","cubieboard4","verdex","overo"
--update re-runs last configure invocation [must be given
as first option!]
--use-clang Build with host Clang instead of GCC cross
@ -476,7 +476,6 @@ supportedTargetArchs="
supportedTargetBoards="
beagleboard
beaglebone
rpi1
rpi2
cubieboard4
verdex

View File

@ -1,45 +0,0 @@
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, kallisti5@unixzen.com
*/
#ifndef _BOARD_RPI1_BOARD_CONFIG_H
#define _BOARD_RPI1_BOARD_CONFIG_H
#define BOARD_NAME_PRETTY "Raspberry Pi"
#define BOARD_CPU_TYPE_ARM6 1
#define BOARD_CPU_BCM2835 1
#include <arch/arm/bcm283X.h>
#define DEVICE_BASE BCM2835_PERIPHERAL_BASE
#define DEVICE_SIZE 0xFFFFFF
#define VECT_BASE 0xFFFF0000
#define VECT_SIZE SIZE_4K
#define SDRAM_BASE BCM283X_SDRAM_BASE
#define SDRAM_SIZE 0x4000000
// 64Mb
// UART Settings
#define BOARD_UART_PL011 1
#define BOARD_UART1_BASE UART0_BASE
// PL011 UART
#define BOARD_UART2_BASE UART1_BASE + 0x40
// miniUART
#define BOARD_UART3_BASE 0
// N/A
#define BOARD_UART_DEBUG DEVICE_BASE + BOARD_UART1_BASE
#define BOARD_UART_CLOCK 3000000
/* 3Mhz */
#endif /* _BOARD_RPI1_BOARD_CONFIG_H */

View File

@ -5,3 +5,8 @@ HaikuSubInclude keyboard_layouts ;
HaikuSubInclude keymaps ;
HaikuSubInclude mime_db ;
HaikuSubInclude settings ;
# Known device trees
if $(TARGET_ARCH) = "arm" {
HaikuSubInclude dts arch $(TARGET_KERNEL_ARCH) ;
}

View File

@ -0,0 +1,10 @@
SubDir HAIKU_TOP src data dts arch arm ;
# Our packaged device trees for this architecture
local target_boards = rpi2 beaglebone-black verdex omap3-overo-tobi omap3-beagle-xm ;
TARGET_DEVICE_TREES = ;
for device in $(target_boards) {
CompileDTS $(device).dtb : [ FDirName $(HAIKU_TOP) src data dts arch $(TARGET_ARCH) $(device).dts ] ;
TARGET_DEVICE_TREES += $(device).dtb ;
}

View File

@ -159,7 +159,7 @@ actions BuildUImageScript1
# requires mtools package on linux
rule BuildUBootSDImage image : files
{
Depends $(image) : $(files) ;
Depends $(image) : $(files) $(TARGET_DEVICE_TREES) ;
SDIMAGE_BLOCK_SIZE on $(image) = 1048576 ; # 1MiB
SDIMAGE_MTOOLS_H on $(image) = 255 ;
SDIMAGE_MTOOLS_S on $(image) = 63 ;
@ -193,8 +193,12 @@ actions BuildUBootSDImage1
# populate
MTOOLSRC=$(1).mtools mcopy $(2[1-]) i:
MTOOLSRC=$(1).mtools mcopy uEnv.txt i:
# populate fdts
MTOOLSRC=$(1).mtools mmd i:\fdt
MTOOLSRC=$(1).mtools mcopy $(TARGET_DEVICE_TREES[1-]) i:\fdt\
# list content
MTOOLSRC=$(1).mtools mdir i:
MTOOLSRC=$(1).mtools mdir i:\fdt
# cleanup
$(RM) $(1).mtools
$(RM) uEnv.txt
@ -248,16 +252,6 @@ BuildUImage haiku_loader_linux.ub : haiku_loader :
-a $(HAIKU_BOARD_LOADER_BASE) -e $(HAIKU_BOARD_LOADER_ENTRY_LINUX)
-n 'haiku_loader $(TARGET_BOOT_BOARD)' ;
if $(HAIKU_BOARD_FDT_NAME) {
local fdtBinary = $(HAIKU_BOARD_FDT_NAME).dtb ;
CompileDTS $(fdtBinary) : [ FDirName $(HAIKU_TOP) src data dts arch $(TARGET_ARCH) $(HAIKU_BOARD_FDT_NAME).dts ] ;
BuildUImage haiku_loader_nbsd.ub : haiku_loader $(tgzArchive) $(fdtBinary) :
-A $(TARGET_ARCH) -O $(uImageFakeOS) -T multi -C none
-a $(HAIKU_BOARD_LOADER_BASE) -e $(HAIKU_BOARD_LOADER_ENTRY_NBSD)
-n 'haiku_loader $(TARGET_BOOT_BOARD)' ;
}
if $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) {
BuildUImageScript $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) :
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT) ;