First pass at getting Acadia running under bochs.
- Create a bochs build script. - Properly configure COM1
This commit is contained in:
parent
93d1299bd9
commit
5a20c23569
9 changed files with 153 additions and 40 deletions
19
scripts/bochs.sh
Executable file
19
scripts/bochs.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
BUILD_DIR="${DIR}/../builddbg"
|
||||
|
||||
bash ${DIR}/build.sh
|
||||
sudo sh ${DIR}/build_image.sh ${BUILD_DIR}/disk.img
|
||||
|
||||
BOCHS_ARGS=
|
||||
if [[ $1 == "debug" ]]; then
|
||||
BOCHS_ARGS+="--dbg"
|
||||
fi
|
||||
|
||||
# TODO Make this portable, build bochs as a part of toolchain?
|
||||
~/opt/bochs/bin/bochs
|
||||
|
||||
32
scripts/build.sh
Executable file
32
scripts/build.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo $DIR
|
||||
|
||||
BUILD_DIR="${DIR}/../builddbg"
|
||||
|
||||
pushd $BUILD_DIR
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
CARGO_USR_ROOT="${DIR}/../sysroot/usr/"
|
||||
CARGO_SYS_ROOT="${DIR}/../sysroot/"
|
||||
|
||||
# Need to pushd so rustup gets the toolchain from rust/rust_toolchain.toml
|
||||
pushd "${DIR}/../rust"
|
||||
|
||||
for BIN in ${DIR}/../rust/usr/*/; do
|
||||
cargo install --force --path "${BIN}" --root $CARGO_USR_ROOT
|
||||
done
|
||||
|
||||
for BIN in ${DIR}/../rust/sys/*/; do
|
||||
cargo install --all-features --force --path "${BIN}" --root $CARGO_SYS_ROOT
|
||||
done
|
||||
popd
|
||||
|
||||
popd
|
||||
|
||||
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
#!/us
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
REPO_ROOT="$SCRIPT_DIR/.."
|
||||
BUILD_DIR="$REPO_ROOT/builddbg"
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Must specify disk image name."
|
||||
fi
|
||||
|
|
@ -15,11 +19,14 @@ if [ -z "$dev" ]; then
|
|||
fi
|
||||
echo "Loopback device: ${dev}"
|
||||
|
||||
EFI_DIR="$BUILD_DIR/efi"
|
||||
SYSROOT="$BUILD_DIR/sysroot"
|
||||
|
||||
cleanup() {
|
||||
umount efi
|
||||
rm -rf efi
|
||||
umount sysroot
|
||||
rm -rf sysroot
|
||||
umount $EFI_DIR
|
||||
rm -rf $EFI_DIR
|
||||
umount $SYSROOT
|
||||
rm -rf $SYSROOT
|
||||
losetup -d $dev
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
@ -30,22 +37,23 @@ mke2fs "${dev}p2"
|
|||
|
||||
limine bios-install "${dev}"
|
||||
|
||||
mkdir -p efi/
|
||||
mount "${dev}p1" efi/
|
||||
|
||||
mkdir -p efi/EFI/BOOT
|
||||
cp /usr/share/limine/BOOTX64.EFI efi/EFI/BOOT
|
||||
cp /usr/share/limine/limine-bios.sys efi/
|
||||
cp ../zion/boot/limine.conf efi/
|
||||
cp zion/zion efi/
|
||||
mkdir -p efi/sys
|
||||
cp ../sysroot/bin/yellowstone efi/sys/yellowstone
|
||||
cp ../sysroot/bin/denali efi/sys/denali
|
||||
cp ../sysroot/bin/victoriafalls efi/sys/victoriafalls
|
||||
mkdir -p $EFI_DIR
|
||||
mount "${dev}p1" $EFI_DIR
|
||||
|
||||
mkdir -p sysroot
|
||||
mount "${dev}p2" sysroot/
|
||||
rsync -a ../sysroot .
|
||||
ls sysroot/
|
||||
mkdir -p $EFI_DIR/EFI/BOOT
|
||||
cp /usr/share/limine/BOOTX64.EFI $EFI_DIR/EFI/BOOT
|
||||
cp /usr/share/limine/limine-bios.sys $EFI_DIR
|
||||
cp $REPO_ROOT/zion/boot/limine.conf $EFI_DIR/
|
||||
cp $BUILD_DIR/zion/zion $EFI_DIR/
|
||||
mkdir -p $EFI_DIR/sys
|
||||
cp $REPO_ROOT/sysroot/bin/yellowstone $EFI_DIR/sys/yellowstone
|
||||
cp $REPO_ROOT/sysroot/bin/denali $EFI_DIR/sys/denali
|
||||
cp $REPO_ROOT/sysroot/bin/victoriafalls $EFI_DIR/sys/victoriafalls
|
||||
|
||||
mkdir -p $SYSROOT
|
||||
mount "${dev}p2" $SYSROOT
|
||||
rsync -a "$REPO_ROOT/sysroot" $BUILD_DIR
|
||||
ls $SYSROOT
|
||||
|
||||
chown drew:drew $1
|
||||
|
|
|
|||
|
|
@ -8,26 +8,9 @@ echo $DIR
|
|||
|
||||
BUILD_DIR="${DIR}/../builddbg"
|
||||
|
||||
pushd $BUILD_DIR
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
CARGO_USR_ROOT="${DIR}/../sysroot/usr/"
|
||||
CARGO_SYS_ROOT="${DIR}/../sysroot/"
|
||||
|
||||
# Need to pushd so rustup gets the toolchain from rust/rust_toolchain.toml
|
||||
pushd "${DIR}/../rust"
|
||||
|
||||
for BIN in ${DIR}/../rust/usr/*/; do
|
||||
cargo install --force --path "${BIN}" --root $CARGO_USR_ROOT
|
||||
done
|
||||
|
||||
for BIN in ${DIR}/../rust/sys/*/; do
|
||||
cargo install --all-features --force --path "${BIN}" --root $CARGO_SYS_ROOT
|
||||
done
|
||||
popd
|
||||
|
||||
sudo sh ${DIR}/build_image.sh disk.img
|
||||
bash ${DIR}/build.sh
|
||||
sudo sh ${DIR}/build_image.sh ${BUILD_DIR}/disk.img
|
||||
|
||||
QEMU_ARGS=
|
||||
if [[ $1 == "debug" ]]; then
|
||||
|
|
@ -35,7 +18,7 @@ if [[ $1 == "debug" ]]; then
|
|||
fi
|
||||
|
||||
# Use machine q35 to access PCI devices.
|
||||
qemu-system-x86_64 -machine q35 -d guest_errors -m 1G -serial stdio -hda disk.img ${QEMU_ARGS} -device nec-usb-xhci,id=xhci -device usb-kbd,bus=xhci.0
|
||||
qemu-system-x86_64 -machine q35 -d guest_errors -m 1G -serial stdio -hda ${BUILD_DIR}/disk.img ${QEMU_ARGS} -device nec-usb-xhci,id=xhci -device usb-kbd,bus=xhci.0
|
||||
popd
|
||||
|
||||
# Extra options to add to this script in the future.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue