- consolidate board specific definitions into build/jam/board/*/BoardSetup to avoid duplicating address values everywhere,
	- add various addresses, boot script, custom C/C++ flags and SD card definition,
	- not sure BoardSetup is included at the best place though,
	- replaced board-specific ldscript with passing the loader address directly to LD from BoardSetup,
- added haiku.mmc target which generates an mmc/SD card image with a FAT partition with the files needed to boot for the board, should later be integrated with haiku.image with the BFS partition offset passed to bfs_shell, requires apt:sfdisk,mtools on GNU/Linux,
- added some more rules, one to build a script for the SD image,
- fake a NetBSD loader for now, U-Boot doesn't know haiku, and we'll need a way to pass the tgz image and RAM size, we'll either use standlone way (usual C argv[]) or the NetBSD args,
- style fixes,
- 80 cols, /me pets Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32284 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2009-08-12 16:12:35 +00:00
parent 0411a172b0
commit feb750d331
8 changed files with 254 additions and 26 deletions

View File

@ -83,4 +83,10 @@ if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
}
}
# Include embedded board-specific file.
# UserBuildConfig can override HAIKU_BOOT_BOARD.
if $(HAIKU_BOOT_BOARD) {
include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD) BoardSetup ] ;
}
PrepareConfigVariables ;

View File

@ -870,6 +870,7 @@ if $(TARGET_PLATFORM) = haiku {
TARGET_GCC_LIBGCC_OBJECTS = ;
TARGET_BOOT_PLATFORM = ;
TARGET_BOOT_BOARD = ;
TARGET_LIBRARY_NAME_MAP = HOST_LIBRARY_NAME_MAP ;
}

View File

@ -0,0 +1,60 @@
# Gumstix Overo board-specific definitions
HAIKU_BOARD_DESCRIPTION = "Gumstix Overo" ;
#
# Various hardcoded addresses
#
# load address for haiku_loader
HAIKU_BOARD_LOADER_BASE = 0x80008000 ;
# entry points (raw binary, and netbsd loader emulation)
HAIKU_BOARD_LOADER_ENTRY_RAW = 0x80008000 ;
HAIKU_BOARD_LOADER_ENTRY_NBSD = 0x80008004 ;
# load address for haiku_loader uimage
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0x84000000 ;
HAIKU_BOARD_LOADER_STACK_BASE = 0x84000000 ;
#
# mmc/SD image
#
# in MB
HAIKU_BOARD_SDIMAGE_SIZE = 256 ;
# in MB
HAIKU_BOARD_SDIMAGE_FAT_SIZE = 32 ;
# offset in blocks XXX: FIXME
# (autodetect from sfdisk or use cylinder count for fat size)
HAIKU_BOARD_SDIMAGE_BFS_OFFSET = ;
# autoboot script
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = gumstix-factory.script ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "if mmcinit; then \
fatload mmc 0 $(HAIKU_BOARD_LOADER_UIBASE) haiku_loader.ub; \
bootm $(HAIKU_BOARD_LOADER_UIBASE); \
fi" ;
HAIKU_BOARD_SDIMAGE_FILES =
haiku_loader
haiku_loader.ub
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)
;
#
# gcc flags for the specific cpu
#
TARGET_KERNEL_CCFLAGS += -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=soft ;
TARGET_KERNEL_C++FLAGS += -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=soft ;
TARGET_CCFLAGS += -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=soft ;
TARGET_C++FLAGS += -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=soft ;

View File

@ -0,0 +1,70 @@
# Gumstix Verdex board-specific definitions
HAIKU_BOARD_DESCRIPTION = "Gumstix Verdex" ;
#
# Various hardcoded addresses
#
# load address for haiku_loader
HAIKU_BOARD_LOADER_BASE = 0xa2000000 ;
# entry points (raw binary, and netbsd loader emulation)
HAIKU_BOARD_LOADER_ENTRY_RAW = 0xa2000000 ;
HAIKU_BOARD_LOADER_ENTRY_NBSD = 0xa2000004 ;
# load address for haiku_loader uimage
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0xa4000000 ;
HAIKU_BOARD_LOADER_STACK_BASE = 0xa4000000 ;
#
# Flash image
#
# u-boot binary image filename, to build the flash image
# XXX: Locate it somehow (for now just put it in generated/)
HAIKU_BOARD_UBOOT_IMAGE ?= u-boot-verdex-400-r1604.bin ;
HAIKU_BOARD_UBOOT_IMAGE_URL =
http://www.gumstix.net/feeds/u-boot/u-boot-verdex-400-r1604.bin ;
#
# mmc/SD image
#
# in MB
HAIKU_BOARD_SDIMAGE_SIZE = 256 ;
# in MB
HAIKU_BOARD_SDIMAGE_FAT_SIZE = 32 ;
# offset in blocks XXX: FIXME
# (autodetect from sfdisk or use cylinder count for fat size)
#HAIKU_BOARD_SDIMAGE_BFS_OFFSET = ;
# autoboot script
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME = gumstix-factory.script ;
HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT = "if mmcinit; then \
fatload mmc 0 $(HAIKU_BOARD_LOADER_UIBASE) haiku_loader.ub; \
bootm $(HAIKU_BOARD_LOADER_UIBASE); \
fi" ;
HAIKU_BOARD_SDIMAGE_FILES =
haiku_loader
haiku_loader.ub
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)
;
#
# gcc flags for the specific cpu
#
TARGET_KERNEL_CCFLAGS += -mcpu=xscale -mfloat-abi=soft ;
TARGET_KERNEL_C++FLAGS += -mcpu=xscale -mfloat-abi=soft ;
TARGET_CCFLAGS += -mcpu=xscale -mfloat-abi=soft ;
TARGET_C++FLAGS += -mcpu=xscale -mfloat-abi=soft ;

View File

@ -23,8 +23,9 @@ local librootFunctions =
;
local extraLinkerArgs = ;
if $(TARGET_BOOT_BOARD) {
extraLinkerArgs += -L$(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/board/$(TARGET_BOOT_BOARD) ;
if $(HAIKU_BOARD_LOADER_BASE) {
#extraLinkerArgs += -L$(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/board/$(TARGET_BOOT_BOARD) ;
extraLinkerArgs += --defsym BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ;
}
AddResources haiku_loader : boot_loader.rdef ;

View File

@ -15,6 +15,10 @@ UsePrivateHeaders [ FDirName storage ] ;
SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti -g3 ;
}
# we fake NetBSD since we don't have an OS ID yet for uimage,
# and we also fake a netbsd loader anyway.
local uImageFakeOS = "netbsd" ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
KernelMergeObject boot_platform_u-boot.o :
@ -42,7 +46,8 @@ SubInclude HAIKU_TOP src system boot platform $(TARGET_BOOT_PLATFORM) board ;
SubDir HAIKU_TOP src system boot platform u-boot ;
# bootable flash image
rule BuildUBootFlashImage image : haikuLoader : uboot_image {
rule BuildUBootFlashImage image : haikuLoader : uboot_image
{
Depends $(image) : $(haikuLoader) ;
#Depends $(image) : $(archive) ;
Depends $(image) : $(uboot_image) ;
@ -55,35 +60,132 @@ rule BuildUBootFlashImage image : haikuLoader : uboot_image {
}
actions BuildUBootFlashImage1 {
actions BuildUBootFlashImage1
{
$(RM) $(<)
# make an empty image
dd if=/dev/zero of=$(<) bs=$(FLASH_IMAGE_BLOCK_SIZE) count=$(FLASH_IMAGE_BLOCK_COUNT)
dd of=$(<) \
if=/dev/zero \
bs=$(FLASH_IMAGE_BLOCK_SIZE) \
count=$(FLASH_IMAGE_BLOCK_COUNT)
# add u-boot
dd if=$(>[2]) of=$(<) bs=$(FLASH_IMAGE_BLOCK_SIZE) conv=notrunc
dd of=$(<) \
if=$(>[2]) \
bs=$(FLASH_IMAGE_BLOCK_SIZE) \
conv=notrunc
# add root fs
#dd if=$(>[3]) of=$(<) bs=$(FLASH_IMAGE_BLOCK_SIZE) conv=notrunc seek=$(FLASH_IMAGE_ROOTFS_OFFSET)
# dd of=$(<) \
# if=$(>[3]) \
# bs=$(FLASH_IMAGE_BLOCK_SIZE) \
# conv=notrunc \
# seek=$(FLASH_IMAGE_ROOTFS_OFFSET)
# add haiku_loader (raw, elf or uimage)
dd if=$(>[1]) of=$(<) bs=$(FLASH_IMAGE_BLOCK_SIZE) conv=notrunc seek=$(FLASH_IMAGE_LOADER_OFFSET)
dd of=$(<) \
if=$(>[1]) \
bs=$(FLASH_IMAGE_BLOCK_SIZE) \
conv=notrunc seek=$(FLASH_IMAGE_LOADER_OFFSET)
}
# uImage
rule BuildUImage image : data : args {
rule BuildUImage image : data : args
{
Depends $(image) : $(data) ;
LocalClean clean : $(image) ;
MKIMAGE_ARGS on $(image) = $(args) ;
BuildUImage1 $(image) : $(data) ;
}
actions BuildUImage1 {
actions BuildUImage1
{
mkimage $(MKIMAGE_ARGS) -d $(>) $(<)
}
BuildUImage haiku_loader.ub : haiku_loader : "-A arm -O netbsd -T kernel -C none -a $(BOARD_UBOOT_LOADER_ADDRESS) -e $(BOARD_UBOOT_LOADER_ADDRESS) -n 'haiku_loader'" ;
rule BuildUImageScript script : content
{
LocalClean clean : $(script) ;
SCRIPTCONTENT on $(script) = $(content) ;
SCRIPTNAME on $(script) = $(script) ;
FAKEOS on $(script) = $(uImageFakeOS) ;
BuildUImageScript1 $(script) : $(content) ;
}
BuildUBootFlashImage haiku_flash_image_raw.img : haiku_loader : $(UBOOT_IMAGE) ;
#BuildUBootFlashImage haiku_flash_image_elf.img : boot_loader_u-boot : $(UBOOT_IMAGE) ;
BuildUBootFlashImage haiku_flash_image_uimage.img : haiku_loader.ub : $(UBOOT_IMAGE) ;
actions BuildUImageScript1
{
rm -f $(<) $(<).txt
echo '$(SCRIPTCONTENT)' > $(<).txt
mkimage -A arm -O $(FAKEOS) -T script -C none -n $(SCRIPTNAME) \
-d $(<).txt $(<)
rm -f $(<).txt
}
# SD/mmc image rule
# requires sfdisk and mtools packages on linux
rule BuildUBootSDImage image : files
{
Depends $(image) : $(files) ;
SDIMAGE_BLOCK_SIZE on $(image) = 1MB ;
SDIMAGE_SIZE on $(image) = $(HAIKU_BOARD_SDIMAGE_SIZE) ;
SDIMAGE_FDISK on $(image) = /sbin/sfdisk ;
SDIMAGE_FDISK_SCRIPT on $(image) =
"0,$(HAIKU_BOARD_SDIMAGE_FAT_SIZE),0c,-\\\n,,eb\\\n\\\n" ;
SDIMAGE_FDISK_H on $(image) = 255 ;
SDIMAGE_FDISK_S on $(image) = 63 ;
SDIMAGE_FDISK_UNIT on $(image) = M ;
BuildUBootSDImage1 $(image) : $(files) ;
}
actions BuildUBootSDImage1
{
$(RM) $(<)
$(RM) $(<).mtools
# make an empty image
dd of=$(<) \
if=/dev/zero \
bs=$(SDIMAGE_BLOCK_SIZE) \
count=$(SDIMAGE_SIZE)
# partition it
echo -e '$(SDIMAGE_FDISK_SCRIPT)' | $(SDIMAGE_FDISK) -f -D \
-H $(SDIMAGE_FDISK_H) -S $(SDIMAGE_FDISK_S) \
-u$(SDIMAGE_FDISK_UNIT) $(<)
# generate mtools config
echo 'drive i: file="$(<)" partition=1' > $(<).mtools
# format the image
MTOOLSRC=$(<).mtools mformat i:
# populate
MTOOLSRC=$(<).mtools mcopy $(>) i:
# list content
MTOOLSRC=$(<).mtools mdir i:
# cleanup
$(RM) $(<).mtools
}
# uimage targets
BuildUImage haiku_loader.ub : haiku_loader :
-A arm -O $(uImageFakeOS) -T kernel -C none
-a $(HAIKU_BOARD_LOADER_BASE) -e $(HAIKU_BOARD_LOADER_ENTRY_RAW)
-n 'haiku_loader' ;
if $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) {
BuildUImageScript $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) :
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT) ;
}
# flash image targets
BuildUBootFlashImage haiku_flash_image_raw.img : haiku_loader :
$(HAIKU_BOARD_UBOOT_IMAGE) ;
#BuildUBootFlashImage haiku_flash_image_elf.img : boot_loader_u-boot :
# $(HAIKU_BOARD_UBOOT_IMAGE) ;
BuildUBootFlashImage haiku_flash_image_uimage.img : haiku_loader.ub :
$(HAIKU_BOARD_UBOOT_IMAGE) ;
# SD/mmc image targets
BuildUBootSDImage haiku.mmc : $(HAIKU_BOARD_SDIMAGE_FILES) ;
SEARCH on [ FGristFiles text_menu.cpp ]
= [ FDirName $(HAIKU_TOP) src system boot platform generic ] ;

View File

@ -1,6 +0,0 @@
/*
* Gumstix Overo ld definitions
*/
BOARD_LOADER_BASE = 0x80008000 ;

View File

@ -1,6 +0,0 @@
/*
* Gumstix Verdex ld definitions
*/
BOARD_LOADER_BASE = 0xa2000000 ;