From 855fc5a0d320b936e1a20f525e9b857673709c49 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 9 Jul 2017 22:19:51 -0500 Subject: [PATCH] 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. --- build/jam/ArchitectureRules | 5 -- build/jam/board/beagleboard/BoardSetup | 3 +- build/jam/board/beaglebone/BoardSetup | 3 +- build/jam/board/overo/BoardSetup | 3 +- build/jam/board/rpi1/BoardSetup | 66 ------------------- build/jam/board/rpi1/config.txt | 25 ------- build/jam/board/rpi2/BoardSetup | 3 +- configure | 3 +- .../kernel/arch/arm/board/rpi1/board_config.h | 45 ------------- src/data/Jamfile | 5 ++ src/data/dts/arch/arm/Jamfile | 10 +++ src/system/boot/platform/u-boot/Jamfile | 16 ++--- 12 files changed, 25 insertions(+), 162 deletions(-) delete mode 100644 build/jam/board/rpi1/BoardSetup delete mode 100644 build/jam/board/rpi1/config.txt delete mode 100644 headers/private/kernel/arch/arm/board/rpi1/board_config.h create mode 100644 src/data/dts/arch/arm/Jamfile diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index e55eba9138..e0528fdfc0 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -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 ; diff --git a/build/jam/board/beagleboard/BoardSetup b/build/jam/board/beagleboard/BoardSetup index 7731f5dd3c..e94aa8af94 100644 --- a/build/jam/board/beagleboard/BoardSetup +++ b/build/jam/board/beagleboard/BoardSetup @@ -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 ; diff --git a/build/jam/board/beaglebone/BoardSetup b/build/jam/board/beaglebone/BoardSetup index 73aa53888b..998ad7d870 100644 --- a/build/jam/board/beaglebone/BoardSetup +++ b/build/jam/board/beaglebone/BoardSetup @@ -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) diff --git a/build/jam/board/overo/BoardSetup b/build/jam/board/overo/BoardSetup index 560edc0d5f..7e911d7504 100644 --- a/build/jam/board/overo/BoardSetup +++ b/build/jam/board/overo/BoardSetup @@ -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) ; diff --git a/build/jam/board/rpi1/BoardSetup b/build/jam/board/rpi1/BoardSetup deleted file mode 100644 index 3fd42ccacc..0000000000 --- a/build/jam/board/rpi1/BoardSetup +++ /dev/null @@ -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 ; - diff --git a/build/jam/board/rpi1/config.txt b/build/jam/board/rpi1/config.txt deleted file mode 100644 index d7e54cf586..0000000000 --- a/build/jam/board/rpi1/config.txt +++ /dev/null @@ -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= diff --git a/build/jam/board/rpi2/BoardSetup b/build/jam/board/rpi2/BoardSetup index e6d3661205..75ed9c8587 100644 --- a/build/jam/board/rpi2/BoardSetup +++ b/build/jam/board/rpi2/BoardSetup @@ -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 diff --git a/configure b/configure index ec76453e37..7dbbde2b61 100755 --- a/configure +++ b/configure @@ -85,7 +85,7 @@ options: ones the secondary architectures. --target-board ARM only: Target board to build for. 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 diff --git a/headers/private/kernel/arch/arm/board/rpi1/board_config.h b/headers/private/kernel/arch/arm/board/rpi1/board_config.h deleted file mode 100644 index 67f23ad088..0000000000 --- a/headers/private/kernel/arch/arm/board/rpi1/board_config.h +++ /dev/null @@ -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 - -#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 */ diff --git a/src/data/Jamfile b/src/data/Jamfile index 6e51e71fa4..5328196331 100644 --- a/src/data/Jamfile +++ b/src/data/Jamfile @@ -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) ; +} diff --git a/src/data/dts/arch/arm/Jamfile b/src/data/dts/arch/arm/Jamfile new file mode 100644 index 0000000000..e869b90bf7 --- /dev/null +++ b/src/data/dts/arch/arm/Jamfile @@ -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 ; +} diff --git a/src/system/boot/platform/u-boot/Jamfile b/src/system/boot/platform/u-boot/Jamfile index 52aed326fc..88a589e285 100644 --- a/src/system/boot/platform/u-boot/Jamfile +++ b/src/system/boot/platform/u-boot/Jamfile @@ -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) ;