axeld + bonefish:

Changed the way the VMware image is built. Instead of creating a normal
image first and then adding vmdk header and that image, we create the
VMware image in one go, now. Therefore "jam update-vmware-image ..."
does now actually update the VMware image directly, instead of updating
the normal image and recreating the VMware image.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23972 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-02-17 13:54:32 +00:00
parent a17d1cf43e
commit 2fcb695c2b
3 changed files with 39 additions and 19 deletions

View File

@ -588,10 +588,7 @@ AddTargetVariableToScript $(script) : <build>makebootable ;
AddTargetVariableToScript $(script) : <build>rc ;
AddTargetVariableToScript $(script) : <build>resattr ;
AddTargetVariableToScript $(script) : <build>unzip ;
#AddTargetVariableToScript $(script) : $(HAIKU_IMAGE) : imagePath ;
# causes a cyclic dependency
AddVariableToScript $(script) : imagePath
: [ FDirName $(HAIKU_IMAGE_DIR) $(HAIKU_IMAGE_NAME) ] ;
AddTargetVariableToScript $(script) : <build>vmdkheader ;
AddVariableToScript $(script) : sourceDirsToCopy
: $(HAIKU_INSTALL_SOURCE_DIRS) ;
@ -607,12 +604,10 @@ CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
CreateHaikuImageUnzipFilesScript $(HAIKU_IMAGE_UNZIP_FILES_SCRIPT) ;
# Convenience wrapper rule around BuildHaikuImage.
rule _BuildHaikuImage
rule _BuildHaikuImage image : isImage : isVMwareImage
{
# _BuildHaikuImage <image target> : <isImage> ;
# _BuildHaikuImage <image target> : <isImage> : <isVMwareImage> ;
#
local image = $(1) ;
local isImage = $(2) ;
# build the image
# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
@ -625,6 +620,7 @@ rule _BuildHaikuImage
$(HAIKU_IMAGE_UNZIP_FILES_SCRIPT)
$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
: $(isImage)
: $(isVMwareImage)
;
# remove the scripts we have generated
@ -641,18 +637,17 @@ _BuildHaikuImage $(HAIKU_IMAGE) : true ;
NotFile haiku-image ;
Depends haiku-image : $(HAIKU_IMAGE) ;
# install Haiku into a directory
NotFile install-haiku ;
_BuildHaikuImage install-haiku : 0 ;
#pragma mark - Build The VMWare Image
# build the VMware image
HAIKU_VMWARE_IMAGE_NAME ?= haiku.vmdk ;
HAIKU_VMWARE_IMAGE ?= $(HAIKU_VMWARE_IMAGE_NAME) ;
MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ;
BuildVMWareImage $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE)
: $(HAIKU_IMAGE_SIZE) ;
_BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ;
NotFile haiku-vmware-image ;
Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ;

View File

@ -624,9 +624,9 @@ rule CreateHaikuImageUnzipFilesScript script
CreateContainerUnzipFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ;
}
rule BuildHaikuImage haikuImage : scripts : isImage
rule BuildHaikuImage haikuImage : scripts : isImage : isVMwareImage
{
# BuildHaikuImage <haiku image> : <scripts> : <is image> ;
# BuildHaikuImage <haiku image> : <scripts> : <is image> : <isVMwareImage> ;
if $(isImage) = 1 || $(isImage) = true {
IS_IMAGE on $(haikuImage) = 1 ;
@ -634,6 +634,12 @@ rule BuildHaikuImage haikuImage : scripts : isImage
IS_IMAGE on $(haikuImage) = "" ;
}
if $(isVMwareImage) = 1 || $(isVMwareImage) = true {
IS_VMWARE_IMAGE on $(haikuImage) = 1 ;
} else {
IS_VMWARE_IMAGE on $(haikuImage) = "" ;
}
local mainScript = build_haiku_image ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
@ -643,7 +649,9 @@ rule BuildHaikuImage haikuImage : scripts : isImage
actions BuildHaikuImage1
{
export imagePath="$(1)"
export isImage="$(IS_IMAGE)"
export isVMwareImage="$(IS_VMWARE_IMAGE)"
$(2[1]) $(2[2-])
}

View File

@ -12,6 +12,7 @@
# sourceDirsToCopy
# updateOnly
# dontClearImage
# isVMwareImage
#
# bfsShell
# copyattr
@ -20,6 +21,7 @@
# resattr
# rc
# unzip
# vmdkheader
#
if [ $# -gt 0 ]; then
. $1
@ -93,15 +95,30 @@ unzipFile()
# create the image and mount it
if [ $isImage ]; then
echo
imageOffsetFlags=
if [ $isVMwareImage ]; then
imageOffsetFlags="--start-offset 65536"
fi
if [ ! $updateOnly ]; then
echo "Creating image ..."
if [ ! -e $imagePath -o ! "$dontClearImage" ]; then
dd if=/dev/zero of=$imagePath bs=1048576 count=$imageSize
ddFlags=
if [ $isVMwareImage ]; then
rm -f $imagePath
$vmdkheader -h 64k -i${imageSize}M $imagePath || exit 1
ddFlags="conv=notrunc oflag=append"
dontClearImage=
fi
$bfsShell --initialize $imagePath Haiku
$makebootable $imagePath
if [ ! -e $imagePath -o ! "$dontClearImage" ]; then
dd if=/dev/zero of=$imagePath bs=1048576 count=$imageSize $ddFlags
fi
$bfsShell --initialize $imageOffsetFlags $imagePath Haiku
$makebootable $imageOffsetFlags $imagePath
fi
$bfsShell -n $imagePath > /dev/null &
$bfsShell -n $imageOffsetFlags $imagePath > /dev/null &
sleep 1
fi