2004-11-16 04:45:22 +03:00
#!/bin/sh
2004-11-16 05:25:16 +03:00
# This script will compile all files needed to create a bootable Haiku image,
# create such an image, and copy the files to the correct location.
#
# You need the Userland FS Server package from Ingo Weinhold to successfully
# create the image, and you also need to have the UserlandFSServer running
# in the background when you start the script.
#
# Usage: makehdimage [image path]
# If you don't specify the image, $sourceDir/haiku.image will be used. In
# the current default configuration, you have to start this script in the
# "current" directory of the Haiku tree. A 40 MB image will be created there.
#
# You may want to change it to suit your needs. Have fun!
2004-11-16 04:45:22 +03:00
# path of the checked out Haiku sources
2004-11-16 05:25:16 +03:00
sourceDir=.
2004-11-16 04:45:22 +03:00
# disk image path, size in MB
2004-11-16 05:25:16 +03:00
if [ "$1" == "" ]; then
imagePath=$sourceDir/haiku.image
else
imagePath=$1
fi
2004-11-16 04:45:22 +03:00
imageSize=40
# ufs_mount path
2004-11-16 05:25:16 +03:00
ufsMount=/boot/home/config/bin/ufs_mount
2004-11-16 04:45:22 +03:00
# build everything needed
2004-11-16 05:25:16 +03:00
previousDir=`pwd`
2004-11-16 04:45:22 +03:00
cd $sourceDir
2004-11-16 05:25:16 +03:00
sourceDir=`pwd`
# we accept relative source directories as well
echo "Building $imageSize MB image at $imagePath..."
2004-11-16 04:45:22 +03:00
RUN_WITHOUT_APP_SERVER=1
2004-11-16 05:25:16 +03:00
2004-11-19 22:49:40 +03:00
BEOS_BIN="touch sync ln listattr listsem listport du rm date \
2004-11-18 23:46:16 +03:00
true false ls df mount unmount cp mv ps sh mkdir sleep"
2004-11-16 05:25:16 +03:00
BEOS_SYSTEM_LIB="libbe.so libstdc++.r4.so libnet.so"
2004-11-16 04:45:22 +03:00
jam -q kernel boot_loader config_manager pci isa ide scsi \
ide_isa bfs blkman fast_log ide_adapter locked_pool \
2004-11-16 05:25:16 +03:00
scsi_periph intel keyboard scsi_dsk scsi_cd \
rld.so kernel_fortune consoled \
$BEOS_BIN $BEOS_SYSTEM_LIB \
kernel_uname libnet.so null zero random \<driver\>tty || exit 1
2004-11-16 04:45:22 +03:00
# create the image and the directory structure
dd if=/dev/zero of=$imagePath bs=1M count=$imageSize
mkbfs $imagePath Haiku
mkdir -p /haiku
sync
$ufsMount obfs $imagePath /haiku || exit 1
cd /haiku
mkdir -p beos/system/add-ons/kernel/bus_managers
mkdir -p beos/system/add-ons/kernel/generic
mkdir -p beos/system/add-ons/kernel/file_systems
mkdir -p beos/system/add-ons/kernel/partitioning_systems
mkdir -p beos/system/add-ons/kernel/busses/ide
mkdir -p beos/system/add-ons/kernel/boot
mkdir -p beos/system/add-ons/kernel/drivers/bin
mkdir -p beos/system/add-ons/kernel/drivers/dev/disk/scsi
mkdir -p beos/bin
mkdir -p beos/system/lib
mkdir -p beos/system/boot
mkdir -p beos/etc
2004-11-16 05:25:16 +03:00
mkdir -p home/config
2004-11-16 04:45:22 +03:00
# modules
cd $sourceDir/distro/x86.R1/beos/system/add-ons/kernel
for f in bus_managers/isa bus_managers/ide bus_managers/scsi busses/ide/ide_isa \
file_systems/bfs generic/blkman generic/fast_log generic/ide_adapter \
generic/locked_pool generic/scsi_periph partitioning_systems/intel; do
cp $f /haiku/beos/system/add-ons/kernel/$f
done
for f in drivers/dev/disk/scsi/scsi_dsk drivers/dev/disk/scsi/scsi_cd; do
name=drivers/bin/$(basename $f)
cp $name /haiku/beos/system/add-ons/kernel/$name
done
cd $sourceDir/objects/x86.R1/add-ons/kernel
for f in bus_managers/config_manager bus_managers/pci; do
name=$(basename $f)
cp $f/$name /haiku/beos/system/add-ons/kernel/$f
done
# drivers
for f in drivers/arch/x86/keyboard/keyboard; do
cp $f /haiku/beos/system/add-ons/kernel/drivers/bin
done
cd $sourceDir/distro/x86.R1/beos/system/add-ons/kernel/drivers/dev
for f in tty random null zero; do
cp $f /haiku/beos/system/add-ons/kernel/drivers/bin
done
# kernel
cp $sourceDir/objects/x86.R1/kernel/kernel /haiku/beos/system/kernel_x86
# libs
cd $sourceDir/distro/x86.R1/beos/system/lib
2004-11-16 05:25:16 +03:00
cp $BEOS_SYSTEM_LIB /haiku/beos/system/lib/
2004-11-16 04:45:22 +03:00
cd $sourceDir/objects/x86.R1/kernel/
cp rld.so libroot.so /haiku/beos/system/lib/
# apps
cd $sourceDir/objects/x86.R1/kernel
2004-11-16 05:25:16 +03:00
for f in fortune uname; do
2004-11-16 04:45:22 +03:00
cp kernel_$f /haiku/beos/bin/$f
done
2004-11-16 05:25:16 +03:00
cd $sourceDir/distro/x86.R1/beos/bin
cp ../apps/consoled $BEOS_BIN /haiku/beos/bin/
# scripts and data files
cd $sourceDir
cp data/system/boot/Bootscript data/system/boot/SetupEnvironment /haiku/beos/system/boot/
cp data/etc/profile /haiku/beos/etc/
cp src/kernel/apps/fortune/fortunes /haiku/beos/etc/
2004-11-16 04:45:22 +03:00
# boot loader
cd /haiku/beos/system
objcopy -O binary $sourceDir/objects/x86.R1/kernel/boot_loader zbeos
# boot module links
cd /haiku/beos/system/add-ons/kernel/boot
for f in bus_managers/config_manager bus_managers/pci bus_managers/isa bus_managers/ide bus_managers/scsi busses/ide/ide_isa file_systems/bfs generic/blkman generic/fast_log generic/ide_adapter generic/locked_pool generic/scsi_periph partitioning_systems/intel; do
ln -fs /boot/beos/system/add-ons/kernel/$f $(basename $f)
done
for f in drivers/dev/disk/scsi/scsi_dsk drivers/dev/disk/scsi/scsi_cd; do
ln -fs /boot/beos/system/add-ons/kernel/drivers/bin/$(basename $f) .
done
# driver links
cd /haiku/beos/system/add-ons/kernel
for f in drivers/dev/keyboard drivers/dev/null drivers/dev/tty drivers/dev/zero \
drivers/dev/disk/scsi/scsi_dsk drivers/dev/disk/scsi/scsi_cd; do
relName=$(echo $f | sed -e s@drivers/dev/@@)
linkName=bin/$(basename $f)
while [ $relName != . ]; do
relName=$(dirname $relName)
linkName=../$linkName
done
(cd $(dirname $f); ln -fs $linkName .)
done
2004-11-16 05:25:16 +03:00
cd $previousDir
2004-11-16 04:45:22 +03:00
sync
unmount /haiku
2004-11-18 23:46:16 +03:00
rmdir /haiku