mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:17:35 +00:00
Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
This commit is contained in:
parent
49727ffee4
commit
450a2a0f9c
236 changed files with 1774 additions and 2337 deletions
|
@ -46,28 +46,35 @@ file(GLOB LIBX86_SOURCES "../../Libraries/LibX86/*.cpp")
|
|||
file(GLOB LIBJS_SOURCES "../../Libraries/LibJS/*.cpp")
|
||||
file(GLOB LIBJS_SUBDIR_SOURCES "../../Libraries/LibJS/*/*.cpp")
|
||||
|
||||
set(SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES} ${LIBIPC_SOURCES} ${LIBLINE_SOURCES} ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBX86_SOURCES})
|
||||
set(LAGOM_CORE_SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES})
|
||||
set(LAGOM_MORE_SOURCES ${LIBIPC_SOURCES} ${LIBLINE_SOURCES} ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBX86_SOURCES})
|
||||
|
||||
include_directories (../../)
|
||||
include_directories (../../Libraries/)
|
||||
add_library(lagom ${SOURCES})
|
||||
add_library(LagomCore ${LAGOM_CORE_SOURCES})
|
||||
|
||||
add_executable(TestApp TestApp.cpp)
|
||||
target_link_libraries(TestApp lagom)
|
||||
target_link_libraries(TestApp stdc++)
|
||||
if (BUILD_LAGOM)
|
||||
add_library(Lagom $<TARGET_OBJECTS:LagomCore> ${LAGOM_MORE_SOURCES})
|
||||
|
||||
add_executable(TestJson TestJson.cpp)
|
||||
target_link_libraries(TestJson lagom)
|
||||
target_link_libraries(TestJson stdc++)
|
||||
add_executable(TestApp TestApp.cpp)
|
||||
target_link_libraries(TestApp Lagom)
|
||||
target_link_libraries(TestApp stdc++)
|
||||
|
||||
add_executable(js ../../Userland/js.cpp)
|
||||
target_link_libraries(js lagom)
|
||||
target_link_libraries(js stdc++)
|
||||
target_link_libraries(js pthread)
|
||||
add_executable(TestJson TestJson.cpp)
|
||||
target_link_libraries(TestJson Lagom)
|
||||
target_link_libraries(TestJson stdc++)
|
||||
|
||||
add_executable(disasm ../../Userland/disasm.cpp)
|
||||
target_link_libraries(disasm lagom)
|
||||
target_link_libraries(disasm stdc++)
|
||||
add_executable(js_lagom ../../Userland/js.cpp)
|
||||
set_target_properties(js_lagom PROPERTIES OUTPUT_NAME js)
|
||||
target_link_libraries(js_lagom Lagom)
|
||||
target_link_libraries(js_lagom stdc++)
|
||||
target_link_libraries(js_lagom pthread)
|
||||
|
||||
add_executable(disasm_lagom ../../Userland/disasm.cpp)
|
||||
set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm)
|
||||
target_link_libraries(disasm_lagom Lagom)
|
||||
target_link_libraries(disasm_lagom stdc++)
|
||||
endif()
|
||||
|
||||
if (ENABLE_FUZZER_SANITIZER)
|
||||
add_subdirectory(Fuzzers)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
cd "$script_path" || exit 1
|
||||
mkdir -p build
|
||||
cd build || exit 1
|
||||
cmake ..
|
||||
make js
|
97
Meta/build-image-grub.sh
Executable file
97
Meta/build-image-grub.sh
Executable file
|
@ -0,0 +1,97 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die() {
|
||||
echo "die: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
die "this script needs to run as root"
|
||||
fi
|
||||
|
||||
grub=$(command -v grub-install 2>/dev/null) || true
|
||||
if [ -z "$grub" ]; then
|
||||
grub=$(command -v grub2-install 2>/dev/null) || true
|
||||
fi
|
||||
if [ -z "$grub" ]; then
|
||||
echo "can't find a grub-install or grub2-install binary, oh no"
|
||||
exit 1
|
||||
fi
|
||||
echo "using grub-install at ${grub}"
|
||||
|
||||
echo "setting up disk image..."
|
||||
dd if=/dev/zero of=_disk_image bs=1M count="${DISK_SIZE:-800}" status=none || die "couldn't create disk image"
|
||||
chown "$SUDO_UID":"$SUDO_GID" _disk_image || die "couldn't adjust permissions on disk image"
|
||||
echo "done"
|
||||
|
||||
printf "creating loopback device... "
|
||||
dev=$(losetup --find --partscan --show _disk_image)
|
||||
if [ -z "$dev" ]; then
|
||||
die "couldn't mount loopback device"
|
||||
fi
|
||||
echo "loopback device is at ${dev}"
|
||||
|
||||
cleanup() {
|
||||
if [ -d mnt ]; then
|
||||
printf "unmounting filesystem... "
|
||||
umount mnt || ( sleep 1 && sync && umount mnt )
|
||||
rmdir mnt
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
if [ -e "${dev}" ]; then
|
||||
printf "cleaning up loopback device... "
|
||||
losetup -d "${dev}"
|
||||
echo "done"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
printf "creating partition table... "
|
||||
if [ "$1" = "mbr" ]; then
|
||||
parted -s "${dev}" mklabel msdos mkpart primary ext2 32k 100% -a minimal set 1 boot on || die "couldn't partition disk"
|
||||
partition_number="p1"
|
||||
partition_scheme="mbr"
|
||||
elif [ "$1" = "gpt" ]; then
|
||||
parted -s "${dev}" mklabel gpt mkpart BIOSBOOT ext3 1MiB 8MiB mkpart OS ext2 8MiB 700MiB set 1 bios_grub || die "couldn't partition disk"
|
||||
partition_number="p2"
|
||||
partition_scheme="gpt"
|
||||
elif [ "$1" = "ebr" ]; then
|
||||
parted -s "${dev}" mklabel msdos mkpart primary 32k 200MiB mkpart primary 200MiB 201MiB mkpart primary 201MiB 202MiB mkpart extended 250MiB 739MiB mkpart logical 372MiB 739MiB -a minimal set 1 boot on || die "couldn't partition disk"
|
||||
partition_number="p5"
|
||||
partition_scheme="ebr"
|
||||
else
|
||||
parted -s "${dev}" mklabel msdos mkpart primary ext2 32k 100% -a minimal set 1 boot on || die "couldn't partition disk"
|
||||
partition_number="p1"
|
||||
partition_scheme="mbr"
|
||||
fi
|
||||
|
||||
echo "done"
|
||||
|
||||
printf "destroying old filesystem... "
|
||||
dd if=/dev/zero of="${dev}${partition_number}" bs=1M count=1 status=none || die "couldn't destroy old filesystem"
|
||||
echo "done"
|
||||
|
||||
printf "creating new filesystem... "
|
||||
mke2fs -q -I 128 "${dev}${partition_number}" || die "couldn't create filesystem"
|
||||
echo "done"
|
||||
|
||||
printf "mounting filesystem... "
|
||||
mkdir -p mnt
|
||||
mount "${dev}${partition_number}" mnt/ || die "couldn't mount filesystem"
|
||||
echo "done"
|
||||
|
||||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
"$script_path/build-root-filesystem.sh"
|
||||
|
||||
echo "installing grub using $grub..."
|
||||
$grub --boot-directory=mnt/boot --target=i386-pc --modules="ext2 part_msdos" "${dev}"
|
||||
|
||||
if [ -d mnt/boot/grub2 ]; then
|
||||
cp grub-"${partition_scheme}".cfg mnt/boot/grub2/grub.cfg
|
||||
else
|
||||
cp grub-"${partition_scheme}".cfg mnt/boot/grub/grub.cfg
|
||||
fi
|
||||
echo "done"
|
88
Meta/build-image-qemu.sh
Executable file
88
Meta/build-image-qemu.sh
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
die() {
|
||||
echo "die: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
die "this script needs to run as root"
|
||||
fi
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
export PATH="/usr/local/opt/e2fsprogs/bin:$PATH"
|
||||
export PATH="/usr/local/opt/e2fsprogs/sbin:$PATH"
|
||||
fi
|
||||
echo "setting up disk image..."
|
||||
qemu-img create _disk_image "${DISK_SIZE:-600}"m || die "could not create disk image"
|
||||
chown "$SUDO_UID":"$SUDO_GID" _disk_image || die "could not adjust permissions on disk image"
|
||||
echo "done"
|
||||
|
||||
printf "creating new filesystem... "
|
||||
if [ "$(uname -s)" = "OpenBSD" ]; then
|
||||
VND=$(vnconfig _disk_image)
|
||||
(echo "e 0"; echo 83; echo n; echo 0; echo "*"; echo "quit") | fdisk -e "$VND"
|
||||
mkfs.ext2 -I 128 -F "/dev/${VND}i" || die "could not create filesystem"
|
||||
elif [ "$(uname -s)" = "FreeBSD" ]; then
|
||||
MD=$(mdconfig _disk_image)
|
||||
mke2fs -q -I 128 _disk_image || die "could not create filesystem"
|
||||
else
|
||||
if [ -x /sbin/mke2fs ]; then
|
||||
/sbin/mke2fs -q -I 128 _disk_image || die "could not create filesystem"
|
||||
else
|
||||
mke2fs -q -I 128 _disk_image || die "could not create filesystem"
|
||||
fi
|
||||
fi
|
||||
echo "done"
|
||||
|
||||
printf "mounting filesystem... "
|
||||
mkdir -p mnt
|
||||
use_genext2fs=0
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
fuse-ext2 _disk_image mnt -o rw+,allow_other,uid=501,gid=20 || die "could not mount filesystem"
|
||||
elif [ "$(uname -s)" = "OpenBSD" ]; then
|
||||
mount -t ext2fs "/dev/${VND}i" mnt/ || die "could not mount filesystem"
|
||||
elif [ "$(uname -s)" = "FreeBSD" ]; then
|
||||
fuse-ext2 -o rw+ "/dev/${MD}" mnt/ || die "could not mount filesystem"
|
||||
else
|
||||
if ! mount _disk_image mnt/ ; then
|
||||
if command -v genext2fs 1>/dev/null ; then
|
||||
echo "mount failed but genext2fs exists, use it instead"
|
||||
use_genext2fs=1
|
||||
else
|
||||
die "could not mount filesystem and genext2fs is missing"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "done"
|
||||
|
||||
cleanup() {
|
||||
if [ -d mnt ]; then
|
||||
if [ $use_genext2fs = 0 ] ; then
|
||||
printf "unmounting filesystem... "
|
||||
umount mnt || ( sleep 1 && sync && umount mnt )
|
||||
fi
|
||||
rmdir mnt
|
||||
if [ "$(uname -s)" = "OpenBSD" ]; then
|
||||
vnconfig -u "$VND"
|
||||
elif [ "$(uname -s)" = "FreeBSD" ]; then
|
||||
mdconfig -d -u "$MD"
|
||||
fi
|
||||
echo "done"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
"$script_path/build-root-filesystem.sh"
|
||||
|
||||
if [ $use_genext2fs = 1 ]; then
|
||||
# regenerate new image, since genext2fs is unable to reuse the previously written image.
|
||||
# genext2fs is very slow in generating big images, so I use a smaller image here. size can be updated
|
||||
# if it's not enough.
|
||||
# not using "-i 128" since it hangs. Serenity handles whatever default this uses instead.
|
||||
genext2fs -b 250000 -d mnt _disk_image || die "try increasing image size (genext2fs -b)"
|
||||
# if using docker with shared mount, file is created as root, so make it writable for users
|
||||
chmod 0666 _disk_image
|
||||
fi
|
157
Meta/build-root-filesystem.sh
Executable file
157
Meta/build-root-filesystem.sh
Executable file
|
@ -0,0 +1,157 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
wheel_gid=1
|
||||
tty_gid=2
|
||||
phys_gid=3
|
||||
audio_gid=4
|
||||
window_uid=13
|
||||
window_gid=13
|
||||
|
||||
die() {
|
||||
echo "die: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$(id -u)" != 0 ]; then
|
||||
die "this script needs to run as root"
|
||||
fi
|
||||
|
||||
[ -z "$SERENITY_ROOT" ] && die "SERENITY_ROOT is not set"
|
||||
[ -d "$SERENITY_ROOT/Base" ] || die "$SERENITY_ROOT/Base doesn't exist"
|
||||
|
||||
umask 0022
|
||||
|
||||
printf "creating initial filesystem structure... "
|
||||
for dir in bin etc proc mnt tmp boot mod; do
|
||||
mkdir -p mnt/$dir
|
||||
done
|
||||
chmod 700 mnt/boot
|
||||
chmod 700 mnt/mod
|
||||
chmod 1777 mnt/tmp
|
||||
echo "done"
|
||||
|
||||
printf "setting up device nodes... "
|
||||
mkdir -p mnt/dev
|
||||
mkdir -p mnt/dev/pts
|
||||
mknod mnt/dev/fb0 b 29 0
|
||||
chmod 660 mnt/dev/fb0
|
||||
chown 0:$phys_gid mnt/dev/fb0
|
||||
mknod mnt/dev/tty0 c 4 0
|
||||
mknod mnt/dev/tty1 c 4 1
|
||||
mknod mnt/dev/tty2 c 4 2
|
||||
mknod mnt/dev/tty3 c 4 3
|
||||
mknod mnt/dev/ttyS0 c 4 64
|
||||
mknod mnt/dev/ttyS1 c 4 65
|
||||
mknod mnt/dev/ttyS2 c 4 66
|
||||
mknod mnt/dev/ttyS3 c 4 67
|
||||
for tty in 0 1 2 3 S0 S1 S2 S3; do
|
||||
chmod 620 mnt/dev/tty$tty
|
||||
chown 0:$tty_gid mnt/dev/tty$tty
|
||||
done
|
||||
mknod mnt/dev/random c 1 8
|
||||
mknod mnt/dev/null c 1 3
|
||||
mknod mnt/dev/zero c 1 5
|
||||
mknod mnt/dev/full c 1 7
|
||||
# random, is failing (randomly) on fuse-ext2 on macos :)
|
||||
chmod 666 mnt/dev/random || true
|
||||
chmod 666 mnt/dev/null
|
||||
chmod 666 mnt/dev/zero
|
||||
chmod 666 mnt/dev/full
|
||||
mknod mnt/dev/keyboard c 85 1
|
||||
chmod 440 mnt/dev/keyboard
|
||||
chown 0:$phys_gid mnt/dev/keyboard
|
||||
mknod mnt/dev/mouse c 10 1
|
||||
chmod 440 mnt/dev/mouse
|
||||
chown 0:$phys_gid mnt/dev/mouse
|
||||
mknod mnt/dev/audio c 42 42
|
||||
chmod 220 mnt/dev/audio
|
||||
chown 0:$audio_gid mnt/dev/audio
|
||||
mknod mnt/dev/ptmx c 5 2
|
||||
chmod 666 mnt/dev/ptmx
|
||||
mknod mnt/dev/hda b 3 0
|
||||
mknod mnt/dev/hdb b 3 1
|
||||
mknod mnt/dev/hdc b 4 0
|
||||
mknod mnt/dev/hdd b 4 1
|
||||
for hd in a b c d; do
|
||||
chmod 600 mnt/dev/hd$hd
|
||||
done
|
||||
|
||||
ln -s /proc/self/fd/0 mnt/dev/stdin
|
||||
ln -s /proc/self/fd/1 mnt/dev/stdout
|
||||
ln -s /proc/self/fd/2 mnt/dev/stderr
|
||||
echo "done"
|
||||
|
||||
printf "installing base system... "
|
||||
cp -R "$SERENITY_ROOT"/Base/* mnt/
|
||||
cp -R Root/* mnt/
|
||||
chmod 400 mnt/res/kernel.map
|
||||
|
||||
chmod 660 mnt/etc/WindowServer/WindowServer.ini
|
||||
chown $window_uid:$window_gid mnt/etc/WindowServer/WindowServer.ini
|
||||
echo "/bin/sh" > mnt/etc/shells
|
||||
|
||||
chown 0:$wheel_gid mnt/bin/su
|
||||
chown 0:$phys_gid mnt/bin/shutdown
|
||||
chown 0:$phys_gid mnt/bin/reboot
|
||||
chown 0:0 mnt/boot/Kernel
|
||||
chown 0:0 mnt/res/kernel.map
|
||||
chmod 0400 mnt/res/kernel.map
|
||||
chmod 0400 mnt/boot/Kernel
|
||||
chmod 4750 mnt/bin/su
|
||||
chmod 4755 mnt/bin/ping
|
||||
chmod 4750 mnt/bin/reboot
|
||||
chmod 4750 mnt/bin/shutdown
|
||||
|
||||
echo "done"
|
||||
|
||||
printf "installing users... "
|
||||
mkdir -p mnt/root
|
||||
mkdir -p mnt/home/anon
|
||||
mkdir -p mnt/home/anon/Desktop
|
||||
mkdir -p mnt/home/anon/Downloads
|
||||
mkdir -p mnt/home/nona
|
||||
cp "$SERENITY_ROOT"/ReadMe.md mnt/home/anon/
|
||||
cp -r "$SERENITY_ROOT"/Libraries/LibJS/Tests mnt/home/anon/js-tests
|
||||
chmod 700 mnt/root
|
||||
chmod 700 mnt/home/anon
|
||||
chmod 700 mnt/home/nona
|
||||
chown -R 0:0 mnt/root
|
||||
chown -R 100:100 mnt/home/anon
|
||||
chown -R 200:200 mnt/home/nona
|
||||
echo "done"
|
||||
|
||||
printf "installing shortcuts... "
|
||||
ln -s FileManager mnt/bin/fm
|
||||
ln -s HelloWorld mnt/bin/hw
|
||||
ln -s IRCClient mnt/bin/irc
|
||||
ln -s Minesweeper mnt/bin/ms
|
||||
ln -s Shell mnt/bin/sh
|
||||
ln -s Snake mnt/bin/sn
|
||||
ln -s Taskbar mnt/bin/tb
|
||||
ln -s VisualBuilder mnt/bin/vb
|
||||
ln -s WidgetGallery mnt/bin/wg
|
||||
ln -s TextEditor mnt/bin/te
|
||||
ln -s HexEditor mnt/bin/he
|
||||
ln -s PaintBrush mnt/bin/pb
|
||||
ln -s QuickShow mnt/bin/qs
|
||||
ln -s Piano mnt/bin/pi
|
||||
ln -s SystemDialog mnt/bin/sd
|
||||
ln -s Calculator mnt/bin/calc
|
||||
ln -s Calendar mnt/bin/calendar
|
||||
ln -s Inspector mnt/bin/ins
|
||||
ln -s SoundPlayer mnt/bin/sp
|
||||
ln -s Help mnt/bin/help
|
||||
ln -s Browser mnt/bin/br
|
||||
ln -s HackStudio mnt/bin/hs
|
||||
ln -s SystemMonitor mnt/bin/sm
|
||||
ln -s ProfileViewer mnt/bin/pv
|
||||
ln -s WebServer mnt/bin/ws
|
||||
ln -s Solitaire mnt/bin/sl
|
||||
echo "done"
|
||||
|
||||
# Run local sync script, if it exists
|
||||
if [ -f sync-local.sh ]; then
|
||||
sh sync-local.sh
|
||||
fi
|
14
Meta/debug-kernel.sh
Executable file
14
Meta/debug-kernel.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Set this environment variable to override the default debugger.
|
||||
#
|
||||
[ -z "$SERENITY_KERNEL_DEBUGGER" ] && SERENITY_KERNEL_DEBUGGER="gdb"
|
||||
|
||||
# The QEMU -s option (enabled by default in ./run) sets up a debugger
|
||||
# remote on localhost:1234. So point our debugger there, and inform
|
||||
# the debugger which binary to load symbols, etc from.
|
||||
#
|
||||
$SERENITY_KERNEL_DEBUGGER \
|
||||
-ex "file $(pwd)/kernel" \
|
||||
-ex 'set arch i386:intel' \
|
||||
-ex 'target remote localhost:1234'
|
17
Meta/grub-ebr.cfg
Normal file
17
Meta/grub-ebr.cfg
Normal file
|
@ -0,0 +1,17 @@
|
|||
timeout=1
|
||||
|
||||
menuentry 'SerenityOS (normal)' {
|
||||
root=hd0,5
|
||||
multiboot /boot/kernel root=/dev/hda5
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (No ACPI)' {
|
||||
root=hd0,5
|
||||
multiboot /boot/kernel root=/dev/hda5 acpi=off
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (with serial debug)' {
|
||||
root=hd0,5
|
||||
multiboot /boot/kernel serial_debug root=/dev/hda5
|
||||
}
|
||||
|
16
Meta/grub-gpt.cfg
Normal file
16
Meta/grub-gpt.cfg
Normal file
|
@ -0,0 +1,16 @@
|
|||
timeout=1
|
||||
|
||||
menuentry 'SerenityOS (normal)' {
|
||||
root=hd0,2
|
||||
multiboot /boot/kernel root=/dev/hda2
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (No ACPI)' {
|
||||
root=hd0,2
|
||||
multiboot /boot/kernel root=/dev/hda2 acpi=off
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (with serial debug)' {
|
||||
root=hd0,2
|
||||
multiboot /boot/kernel serial_debug root=/dev/hda2
|
||||
}
|
16
Meta/grub-mbr.cfg
Normal file
16
Meta/grub-mbr.cfg
Normal file
|
@ -0,0 +1,16 @@
|
|||
timeout=1
|
||||
|
||||
menuentry 'SerenityOS (normal)' {
|
||||
root=hd0,1
|
||||
multiboot /boot/kernel root=/dev/hda1
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (No ACPI)' {
|
||||
root=hd0,1
|
||||
multiboot /boot/kernel root=/dev/hda1 acpi=off
|
||||
}
|
||||
|
||||
menuentry 'SerenityOS (with serial debug)' {
|
||||
root=hd0,1
|
||||
multiboot /boot/kernel serial_debug root=/dev/hda1
|
||||
}
|
120
Meta/run.sh
Executable file
120
Meta/run.sh
Executable file
|
@ -0,0 +1,120 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC2086 # FIXME: fix these globing warnings
|
||||
|
||||
set -e
|
||||
|
||||
#SERENITY_PACKET_LOGGING_ARG="-object filter-dump,id=hue,netdev=breh,file=e1000.pcap"
|
||||
|
||||
[ -e /dev/kvm ] && [ -r /dev/kvm ] && [ -w /dev/kvm ] && SERENITY_KVM_ARG="-enable-kvm"
|
||||
|
||||
[ -z "$SERENITY_BOCHS_BIN" ] && SERENITY_BOCHS_BIN="bochs"
|
||||
|
||||
[ -z "$SERENITY_QEMU_BIN" ] && SERENITY_QEMU_BIN="qemu-system-i386"
|
||||
|
||||
[ -z "$SERENITY_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
|
||||
|
||||
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=256M
|
||||
|
||||
[ -z "$SERENITY_COMMON_QEMU_ARGS" ] && SERENITY_COMMON_QEMU_ARGS="
|
||||
$SERENITY_EXTRA_QEMU_ARGS
|
||||
-s -m $SERENITY_RAM_SIZE
|
||||
-cpu max
|
||||
-d cpu_reset,guest_errors
|
||||
-smp 2
|
||||
-device VGA,vgamem_mb=64
|
||||
-hda _disk_image
|
||||
-device ich9-ahci
|
||||
-debugcon stdio
|
||||
-soundhw pcspk
|
||||
-soundhw sb16
|
||||
"
|
||||
|
||||
[ -z "$SERENITY_COMMON_QEMU_Q35_ARGS" ] && SERENITY_COMMON_QEMU_Q35_ARGS="
|
||||
$SERENITY_EXTRA_QEMU_ARGS
|
||||
-s -m $SERENITY_RAM_SIZE
|
||||
-cpu max
|
||||
-machine q35
|
||||
-d cpu_reset,guest_errors
|
||||
-smp 2
|
||||
-device VGA,vgamem_mb=64
|
||||
-device piix3-ide
|
||||
-drive file=_disk_image,id=disk,if=none
|
||||
-device ide-hd,bus=ide.6,drive=disk,unit=0
|
||||
-debugcon stdio
|
||||
-soundhw pcspk
|
||||
-soundhw sb16
|
||||
"
|
||||
|
||||
export SDL_VIDEO_X11_DGAMOUSE=0
|
||||
|
||||
if [ "$1" = "b" ]; then
|
||||
# ./run b: bochs
|
||||
$SERENITY_BOCHS_BIN -q -f .bochsrc
|
||||
elif [ "$1" = "qn" ]; then
|
||||
# ./run qn: qemu without network
|
||||
$SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_ARGS \
|
||||
-device e1000 \
|
||||
-kernel Kernel/Kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}"
|
||||
elif [ "$1" = "qtap" ]; then
|
||||
# ./run qtap: qemu with tap
|
||||
sudo $SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_ARGS \
|
||||
$SERENITY_KVM_ARG \
|
||||
$SERENITY_PACKET_LOGGING_ARG \
|
||||
-netdev tap,ifname=tap0,id=br0 \
|
||||
-device e1000,netdev=br0 \
|
||||
-kernel Kernel/Kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}"
|
||||
elif [ "$1" = "qgrub" ]; then
|
||||
# ./run qgrub: qemu with grub
|
||||
$SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_ARGS \
|
||||
$SERENITY_KVM_ARG \
|
||||
$SERENITY_PACKET_LOGGING_ARG \
|
||||
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
|
||||
-device e1000,netdev=breh
|
||||
elif [ "$1" = "q35_cmd" ]; then
|
||||
SERENITY_KERNEL_CMDLINE=""
|
||||
# FIXME: Someone who knows sh syntax better, please help:
|
||||
for _ in $(seq 2 $#); do
|
||||
shift
|
||||
SERENITY_KERNEL_CMDLINE="$SERENITY_KERNEL_CMDLINE $1"
|
||||
done
|
||||
echo "Starting SerenityOS, Commandline: ${SERENITY_KERNEL_CMDLINE}"
|
||||
# ./run: qemu with SerenityOS with custom commandline
|
||||
$SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_Q35_ARGS \
|
||||
$SERENITY_KVM_ARG \
|
||||
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
|
||||
-device e1000,netdev=breh \
|
||||
-kernel Kernel/Kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}"
|
||||
elif [ "$1" = "qcmd" ]; then
|
||||
SERENITY_KERNEL_CMDLINE=""
|
||||
# FIXME: Someone who knows sh syntax better, please help:
|
||||
for _ in $(seq 2 $#); do
|
||||
shift
|
||||
SERENITY_KERNEL_CMDLINE="$SERENITY_KERNEL_CMDLINE $1"
|
||||
done
|
||||
echo "Starting SerenityOS, Commandline: ${SERENITY_KERNEL_CMDLINE}"
|
||||
# ./run: qemu with SerenityOS with custom commandline
|
||||
$SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_ARGS \
|
||||
$SERENITY_KVM_ARG \
|
||||
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23 \
|
||||
-device e1000,netdev=breh \
|
||||
-kernel Kernel/Kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}"
|
||||
else
|
||||
# ./run: qemu with user networking
|
||||
$SERENITY_QEMU_BIN \
|
||||
$SERENITY_COMMON_QEMU_ARGS \
|
||||
$SERENITY_KVM_ARG \
|
||||
$SERENITY_PACKET_LOGGING_ARG \
|
||||
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-10.0.2.15:8888,hostfwd=tcp:127.0.0.1:8823-10.0.2.15:23,hostfwd=tcp:127.0.0.1:8000-10.0.2.15:8000,hostfwd=tcp:127.0.0.1:2222-10.0.2.15:22 \
|
||||
-device e1000,netdev=breh \
|
||||
-kernel Kernel/Kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}"
|
||||
fi
|
6
Meta/sync.sh
Executable file
6
Meta/sync.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
|
||||
sudo -E PATH="$PATH" "$script_path/build-image-qemu.sh"
|
Loading…
Add table
Add a link
Reference in a new issue