Patch by dnivra (GSoC 2014, ARM suppport)

* Cleanup the SD card image building to allow jam -q @bootstrap-mmc to
work.

There are a few remaining tricks before you can safely build an image:
* This uses a non-POSIX du option, and is only tested with Linux du
only (Linux is the only supported system to run bootstrap builds,
anyway)
* The Python recipe in haikuports.cross is known to not build on
Debian/Ubuntu, but work fine on OpenSuse. There is a patch available in
haikuports bugtracker to allow the reverse.
* You need to populate the haikuports repo package list with some
packages (which don't exist yet) to make the build system happy. But our
git hook to generate the repositories is preventnig me to share this
hack.

Once built, the image currently crashes early in the kernel execution.
On to debug that!
This commit is contained in:
PulkoMandy 2014-06-13 17:15:24 +02:00
parent b64f1a9768
commit 3d6edc43d9
5 changed files with 44 additions and 33 deletions

View File

@ -84,6 +84,11 @@ HAIKU_DEFAULT_ANYBOOT_NAME = haiku-anyboot.image ;
HAIKU_DEFAULT_ANYBOOT_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ;
# Haiku MMC defaults
HAIKU_DEFAULT_MMC_IMAGE_NAME = haiku-mmc.image ;
HAIKU_DEFAULT_MMC_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_MMC_LABEL ?= Haiku ;
# analyze and optionally replace jam's target parameters
ProcessCommandLineArguments ;

View File

@ -45,6 +45,7 @@ rule DefineDefaultBuildProfiles
# bootstrap profiles
DefineBuildProfile bootstrap-raw : image : "haiku-bootstrap.image" ;
DefineBuildProfile bootstrap-mmc : haiku-mmc-image : "haiku-mmc.image" ;
DefineBuildProfile bootstrap-vmware : vmware-image
: "haiku-bootstrap.vmdk" ;

View File

@ -369,6 +369,14 @@ rule DefineBuildProfile name : type : path {
buildTarget = haiku-image ;
}
case "haiku-mmc-image" : {
targetName ?= $(HAIKU_MMC_IMAGE_NAME) ;
targetName ?= $(HAIKU_DEFAULT_MMC_IMAGE_NAME) ;
HAIKU_IMAGE_DIR = $(targetDir) ;
HAIKU_IMAGE_NAME = $(targetName) ;
buildTarget = haiku-mmc-image ;
}
case "vmware-image" : {
targetName ?= $(HAIKU_VMWARE_IMAGE_NAME) ;
targetName ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ;

View File

@ -29,13 +29,13 @@ HAIKU_BOARD_LOADER_STACK_BASE = 0x84000000 ;
# OMAP x-loader image, must be first file on FAT partition
HAIKU_BOARD_MLO_IMAGE ?= MLO ;
HAIKU_BOARD_MLO_IMAGE_URL =
http://www.angstrom-distribution.org/demo/beagleboard/MLO ;
http://downloads.angstrom-distribution.org/demo/beagleboard/MLO ;
# 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.bin ;
HAIKU_BOARD_UBOOT_IMAGE ?= u-boot.img ;
HAIKU_BOARD_UBOOT_IMAGE_URL =
http://www.angstrom-distribution.org/demo/beagleboard/u-boot.bin ;
http://downloads.angstrom-distribution.org/demo/beagleboard/u-boot.img ;
#
# mmc/SD image
@ -47,13 +47,15 @@ HAIKU_BOARD_SDIMAGE_SIZE = 64 ;
# 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 = ;
mloFile = [ DownloadFile $(HAIKU_BOARD_MLO_IMAGE)
: $(HAIKU_BOARD_MLO_IMAGE_URL) ] ;
ubootFile = [ DownloadFile $(HAIKU_BOARD_UBOOT_IMAGE)
: $(HAIKU_BOARD_UBOOT_IMAGE_URL) ] ;
HAIKU_BOARD_SDIMAGE_FILES =
$(HAIKU_BOARD_MLO_IMAGE)
$(HAIKU_BOARD_UBOOT_IMAGE)
$(mloFile)
$(ubootFile)
haiku_loader_nbsd.ub
;

View File

@ -155,13 +155,9 @@ rule BuildUBootSDImage image : files
Depends $(image) : $(files) ;
SDIMAGE_BLOCK_SIZE on $(image) = 1048576 ; # 1M
SDIMAGE_SIZE on $(image) = $(HAIKU_BOARD_SDIMAGE_SIZE) ;
SDIMAGE_FDISK on $(image) = $(HOST_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_C on $(image) = ;
SDIMAGE_FDISK_UNIT on $(image) = M ;
SDIMAGE_MTOOLS_H on $(image) = 255 ;
SDIMAGE_MTOOLS_S on $(image) = 63 ;
SDIMAGE_MTOOLS_C on $(image) = 8 ;
BuildUBootSDImage1 $(image) : $(files) ;
}
@ -175,21 +171,29 @@ actions BuildUBootSDImage1
if=/dev/zero \
bs=$(SDIMAGE_BLOCK_SIZE) \
count=$(SDIMAGE_SIZE)
# partition it
printf '$(SDIMAGE_FDISK_SCRIPT)' | $(SDIMAGE_FDISK) -f -D \
-H $(SDIMAGE_FDISK_H) -S $(SDIMAGE_FDISK_S) \
-u$(SDIMAGE_FDISK_UNIT) $(<)
#-H $(SDIMAGE_FDISK_H) -S $(SDIMAGE_FDISK_S) -C \\\$(( $(SDIMAGE_SIZE) * 1024 * 1024 / $(SDIMAGE_FDISK_H) / $(SDIMAGE_FDISK_S))) \
# generate mtools config
echo 'drive i: file="$(<)" partition=1' > $(<).mtools
echo 'drive i: file="$(<)" partition=1 cylinders=$(SDIMAGE_MTOOLS_C)
heads=$(SDIMAGE_MTOOLS_H) sectors=$(SDIMAGE_MTOOLS_S)
mformat_only' > $(<).mtools
# partition it
MTOOLSRC=$(<).mtools mpartition -cI -T 0xc i:
# format the image
MTOOLSRC=$(<).mtools mformat -v "Haiku" i:
MTOOLSRC=$(<).mtools mformat -L 32 -v "Haiku" i:
# generate u-boot environment variables
echo 'uenvcmd=run loadImage; run mmcboot;
loadImage=fatload mmc0 0 0x80008000 haiku_loader_nbsd.ub
mmcboot=bootm 0x80008000' > uEnv.txt
# populate
MTOOLSRC=$(<).mtools mcopy $(>) i:
MTOOLSRC=$(<).mtools mcopy uEnv.txt i:
# list content
#MTOOLSRC=$(<).mtools mdir i:
MTOOLSRC=$(<).mtools mdir i:
# cleanup
$(RM) $(<).mtools
$(RM) uEnv.txt
# Add haiku bootstrap partition to MMC image
dd if=$(HAIKU_IMAGE_NAME) of=$(<) conv=notrunc oflag=append bs=1M \
count=`du -sm $(HAIKU_IMAGE_NAME) | cut -f 1`
}
# uimage targets
@ -215,16 +219,6 @@ if $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) {
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT) ;
}
if $(HAIKU_BOARD_MLO_IMAGE) && $(HAIKU_BOARD_MLO_IMAGE_URL) {
DownloadFile $(HAIKU_BOARD_MLO_IMAGE) $(HAIKU_BOARD_MLO_IMAGE_URL) ;
}
if $(HAIKU_BOARD_UBOOT_IMAGE) && $(HAIKU_BOARD_UBOOT_IMAGE_URL) {
# Download the u-boot binary file.
ubootFile = [ DownloadFile $(HAIKU_BOARD_UBOOT_IMAGE)
: $(HAIKU_BOARD_UBOOT_IMAGE_URL) ] ;
}
# flash image targets
BuildUBootFlashImage haiku-$(HAIKU_BOOT_BOARD)_flash_image_raw.img : haiku_loader :
$(ubootFile) ;
@ -245,6 +239,7 @@ Depends haiku-flash-uimage : haiku-$(HAIKU_BOOT_BOARD)_flash_image_uimage.img ;
BuildUBootSDImage haiku-$(HAIKU_BOOT_BOARD).mmc : $(HAIKU_BOARD_SDIMAGE_FILES) ;
NotFile haiku-mmc-image ;
Depends haiku-mmc-image : haiku-$(HAIKU_BOOT_BOARD).mmc ;
Depends haiku-$(HAIKU_BOOT_BOARD).mmc : $(HAIKU_IMAGE_NAME) ;
SEARCH on [ FGristFiles $(genericPlatformSources) ]
= [ FDirName $(HAIKU_TOP) src system boot platform generic ] ;