Initial git commit of OS makefiles (after some time in fossil) with an attempt at using git submodules, but not buildable yet (will be using old paths in the Makefiles and in some submodules).
This commit is contained in:
parent
89cdf46a56
commit
3497058b95
18
.gitmodules
vendored
Normal file
18
.gitmodules
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
[submodule "slkern"]
|
||||
path = slkern
|
||||
url = https://proto.securelang.com/SecureLang/slkern.git
|
||||
[submodule "sllibc"]
|
||||
path = sllibc
|
||||
url = https://proto.securelang.com/SecureLang/sllibc.git
|
||||
[submodule "sllul"]
|
||||
path = sllul
|
||||
url = https://proto.securelang.com/SecureLang/sllul.git
|
||||
[submodule "slmkfs"]
|
||||
path = slmkfs
|
||||
url = https://proto.securelang.com/SecureLang/slmkfs.git
|
||||
[submodule "slbldtls"]
|
||||
path = slbldtls
|
||||
url = https://proto.securelang.com/SecureLang/slbldtls.git
|
||||
[submodule "slabpkg"]
|
||||
path = slabpkg
|
||||
url = https://proto.securelang.com/SecureLang/slabpkg.git
|
25
LICENSE
Normal file
25
LICENSE
Normal file
@ -0,0 +1,25 @@
|
||||
Files marked NEW CODE can be attributed just to Zak's copyright with the same license, other files will either have their own information or are to be taken under the full license including the xv6 copyright statement:
|
||||
|
||||
Copyright (c) 2024, 2025 Zak Yani Star Fenton
|
||||
Copyright (c) 2006-2024 Frans Kaashoek, Robert Morris, Russ Cox,
|
||||
Massachusetts Institute of Technology
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
239
Makefile.gcc
Normal file
239
Makefile.gcc
Normal file
@ -0,0 +1,239 @@
|
||||
K=kernel
|
||||
U=user
|
||||
D=SDK
|
||||
|
||||
# The mandatory CFLAGS are the options needed for the compiler to work
|
||||
# Whereas CFLAGS is now altered later with -Werror added
|
||||
CFLAGS_MANDATORY = -Wall -O -fno-omit-frame-pointer -ggdb -gdwarf-2
|
||||
CFLAGS_MANDATORY += -MD
|
||||
CFLAGS_MANDATORY += -mcmodel=medany
|
||||
# CFLAGS += -ffreestanding -fno-common -nostdlib -mno-relax
|
||||
CFLAGS_MANDATORY += -fno-common -nostdlib
|
||||
CFLAGS_MANDATORY += -fno-builtin-strncpy -fno-builtin-strncmp -fno-builtin-strlen -fno-builtin-memset
|
||||
CFLAGS_MANDATORY += -fno-builtin-memmove -fno-builtin-memcmp -fno-builtin-log -fno-builtin-bzero
|
||||
CFLAGS_MANDATORY += -fno-builtin-strchr -fno-builtin-exit -fno-builtin-malloc -fno-builtin-putc
|
||||
CFLAGS_MANDATORY += -fno-builtin-free
|
||||
CFLAGS_MANDATORY += -fno-builtin-memcpy -Wno-main
|
||||
CFLAGS_MANDATORY += -fno-builtin-printf -fno-builtin-fprintf -fno-builtin-vprintf
|
||||
CFLAGS_MANDATORY += -I.
|
||||
CFLAGS_MANDATORY += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||
|
||||
# Disable PIE when possible (for Ubuntu 16.10 toolchain)
|
||||
ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),)
|
||||
CFLAGS_MANDATORY += -fno-pie -no-pie
|
||||
endif
|
||||
ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]nopie'),)
|
||||
CFLAGS_MANDATORY += -fno-pie -nopie
|
||||
endif
|
||||
|
||||
include libc/include.mk
|
||||
|
||||
OBJS = \
|
||||
$K/entry.o \
|
||||
$K/start.o \
|
||||
$K/riscv.o \
|
||||
$K/console.o \
|
||||
$K/kprintf.o \
|
||||
$K/uart.o \
|
||||
$K/physpg.o \
|
||||
$K/spinlock.o \
|
||||
$K/string.o \
|
||||
$K/main.o \
|
||||
$K/vm.o \
|
||||
$K/bitarray.o \
|
||||
$K/proc.o \
|
||||
$K/trampoline.o \
|
||||
$K/trap.o \
|
||||
$K/syscall.o \
|
||||
$K/sysproc.o \
|
||||
$K/drives.o \
|
||||
$K/diskio.o \
|
||||
$K/vmrd.o \
|
||||
$K/fsinstance.o \
|
||||
$K/sleeplock.o \
|
||||
$K/file.o \
|
||||
$K/pipe.o \
|
||||
$K/exec.o \
|
||||
$K/sysfile.o \
|
||||
$K/kernelvec.o \
|
||||
$K/plic.o \
|
||||
$K/virtio_disk.o \
|
||||
$K/sched.o \
|
||||
$K/sysnew.o \
|
||||
$K/fpu.o \
|
||||
$K/asmnew.o \
|
||||
$K/sync.o \
|
||||
$K/schedasm.o
|
||||
|
||||
AUTOGENOBJS = \
|
||||
autogen/res_data.o
|
||||
|
||||
# riscv64-unknown-elf- or riscv64-linux-gnu-
|
||||
# perhaps in /opt/riscv/bin
|
||||
#TOOLPREFIX =
|
||||
|
||||
# Try to infer the correct TOOLPREFIX if not set
|
||||
ifndef TOOLPREFIX
|
||||
TOOLPREFIX := $(shell if riscv64-unknown-elf-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-elf-'; \
|
||||
elif riscv64-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-linux-gnu-'; \
|
||||
elif riscv64-unknown-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-linux-gnu-'; \
|
||||
else echo "***" 1>&2; \
|
||||
echo "*** Error: Couldn't find a riscv64 version of GCC/binutils." 1>&2; \
|
||||
echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
|
||||
echo "***" 1>&2; exit 1; fi)
|
||||
endif
|
||||
|
||||
QEMU = qemu-system-riscv64
|
||||
|
||||
CC = $(TOOLPREFIX)gcc
|
||||
AS = $(TOOLPREFIX)gas
|
||||
LD = $(TOOLPREFIX)ld
|
||||
OBJCOPY = $(TOOLPREFIX)objcopy
|
||||
OBJDUMP = $(TOOLPREFIX)objdump
|
||||
|
||||
CFLAGS = -Werror $(CFLAGS_MANDATORY)
|
||||
|
||||
LDFLAGS = -z max-page-size=4096
|
||||
|
||||
$K/kernel: $(OBJS) $(AUTOGENOBJS) $K/kernel.ld $U/initcode kernel-audit.txt
|
||||
$(LD) $(LDFLAGS) -T $K/kernel.ld -o $K/kernel $(OBJS) $(AUTOGENOBJS)
|
||||
$(OBJDUMP) -S $K/kernel > $K/kernel.asm
|
||||
$(OBJDUMP) -t $K/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $K/kernel.sym
|
||||
|
||||
$U/initcode: $U/initcode.S
|
||||
$(CC) $(CFLAGS) -march=rv64g -nostdinc -I. -Ikernel -c $U/initcode.S -o $U/initcode.o
|
||||
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o $U/initcode.out $U/initcode.o
|
||||
$(OBJCOPY) -S -O binary $U/initcode.out $U/initcode
|
||||
$(OBJDUMP) -S $U/initcode.o > $U/initcode.asm
|
||||
|
||||
tags: $(OBJS) _init
|
||||
etags *.S *.c
|
||||
|
||||
ULIB = $U/ulib.o $U/usys.o $U/printf.o $U/umalloc.o $K/riscv.o
|
||||
|
||||
_%: %.o $(ULIB)
|
||||
$(LD) $(LDFLAGS) -T $U/user.ld -o $@ $^
|
||||
$(OBJDUMP) -S $@ > $*.asm
|
||||
$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
|
||||
|
||||
$U/usys.S : $U/usys.pl
|
||||
perl $U/usys.pl > $U/usys.S
|
||||
|
||||
$U/usys.o : $U/usys.S
|
||||
$(CC) $(CFLAGS) -c -o $U/usys.o $U/usys.S
|
||||
|
||||
$U/_forktest: $U/forktest.o $(ULIB)
|
||||
# forktest has less library code linked in - needs to be small
|
||||
# in order to be able to max out the proc table.
|
||||
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $U/_forktest $U/forktest.o $U/ulib.o $U/usys.o
|
||||
$(OBJDUMP) -S $U/_forktest > $U/forktest.asm
|
||||
|
||||
mkfs/mkfs: mkfs/mkfs.c mkfs/mkfsv2.c $K/fs.h $K/param.h
|
||||
gcc -Werror -Wall -I. -o mkfs/mkfs mkfs/mkfs.c
|
||||
|
||||
mkfs/mkfsv2: mkfs/main.c mkfs/mkfsv2.c $K/fs.h $K/param.h
|
||||
gcc -Werror -Wall -I. -o mkfs/mkfsv2 mkfs/main.c
|
||||
|
||||
$D/assemble: $D/assemble.c $D/asmln.c $D/asmln.h $D/asmdata.c $D/asmdata.h $D/asmpp.c $D/asmpp.h
|
||||
gcc -I. -o $D/assemble $D/assemble.c
|
||||
|
||||
$D/compilec: $D/compilec.c $D/brutal.c $D/ccb.h $D/ccbgeneric.h
|
||||
gcc -I. -o $D/compilec $D/compilec.c
|
||||
|
||||
$D/audit: $D/audit.c
|
||||
gcc -I. -o $D/audit $D/audit.c
|
||||
|
||||
$D/res2c: $D/res2c.c
|
||||
gcc -I. -o $D/res2c $D/res2c.c
|
||||
|
||||
kernel-audit.txt: $D/audit $(OBJS) libc/elf.h libc/string.c mkfs/fsformat.h
|
||||
$D/audit kernel/*.c kernel/*.h kernel/*.S libc/elf.h libc/string.c mkfs/fsformat.h > kernel-audit.txt
|
||||
|
||||
# Prevent deletion of intermediate files, e.g. cat.o, after first build, so
|
||||
# that disk image changes after first build are persistent until clean. More
|
||||
# details:
|
||||
# http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
|
||||
.PRECIOUS: %.o
|
||||
|
||||
UPROGS=\
|
||||
$U/_cat\
|
||||
$U/_echo\
|
||||
$U/_forktest\
|
||||
$U/_thrdtest\
|
||||
$U/_grep\
|
||||
$U/_init\
|
||||
$U/_kill\
|
||||
$U/_ln\
|
||||
$U/_ls\
|
||||
$U/_mkdir\
|
||||
$U/_rm\
|
||||
$U/_sh\
|
||||
$U/_stressfs\
|
||||
$U/_grind\
|
||||
$U/_wc\
|
||||
$U/_zombie\
|
||||
$U/_libc_drives\
|
||||
$U/_libc_st\
|
||||
$D/_numbered\
|
||||
$D/_libc_assemble\
|
||||
$D/_libc_res2c\
|
||||
$D/_libc_hello\
|
||||
$D/_libc_audit\
|
||||
$U/_libc_scm\
|
||||
AI/_libc_example1
|
||||
|
||||
# $U/_usertests\
|
||||
# $U/_libc_scm\
|
||||
# $D/_libc_compilec
|
||||
|
||||
fs.img: mkfs/mkfsv2 README $U/classic.st $(UPROGS)
|
||||
mkfs/mkfsv2 -v1 --skip_underscores --output fs.img --blocksize 4096 --blocks 2000 README $U/classic.st $(UPROGS)
|
||||
|
||||
ramdisk0.img: mkfs/mkfsv2 README
|
||||
mkfs/mkfsv2 -v0 --blocksize 4096 --output ramdisk0.img --blocks 500 README
|
||||
|
||||
ramdisk1.img: mkfs/mkfsv2 README
|
||||
mkfs/mkfsv2 -v1 --blocksize 4096 --output ramdisk1.img --blocks 800 README SDK/rv64.inc SDK/*.c SDK/*.h
|
||||
|
||||
autogen/res_data.c: $D/res2c ramdisk0.img ramdisk1.img
|
||||
$D/res2c --output autogen/res_data.c --type RAMDISK --filename RD0 ramdisk0.img --type RAMDISK --filename RD1 ramdisk1.img
|
||||
|
||||
-include kernel/*.d user/*.d
|
||||
|
||||
clean:
|
||||
rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
|
||||
*/*.o */*.d */*.asm */*.sym \
|
||||
$U/initcode $U/initcode.out $K/kernel fs.img \
|
||||
mkfs/mkfs mkfs/mkfsv2 $D/assemble $D/compilec $D/audit $D/res2c .gdbinit \
|
||||
ramdisk0.img ramdisk1.img imgsums.txt \
|
||||
$U/usys.S \
|
||||
$(UPROGS)
|
||||
|
||||
# try to generate a unique GDB port
|
||||
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
|
||||
# QEMU's gdb stub command line changed in 0.11
|
||||
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
|
||||
then echo "-gdb tcp::$(GDBPORT)"; \
|
||||
else echo "-s -p $(GDBPORT)"; fi)
|
||||
ifndef CPUS
|
||||
CPUS := 3
|
||||
endif
|
||||
|
||||
QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nographic
|
||||
QEMUOPTS += -global virtio-mmio.force-legacy=false
|
||||
QEMUOPTS += -drive file=fs.img,if=none,format=raw,id=x0
|
||||
QEMUOPTS += -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
||||
|
||||
qemu: $K/kernel fs.img
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
.gdbinit: .gdbinit.tmpl-riscv
|
||||
sed "s/:1234/:$(GDBPORT)/" < $^ > $@
|
||||
|
||||
qemu-gdb: $K/kernel .gdbinit fs.img
|
||||
@echo "*** Now run 'gdb' in another window." 1>&2
|
||||
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)
|
||||
|
271
Makefile.slcc
Normal file
271
Makefile.slcc
Normal file
@ -0,0 +1,271 @@
|
||||
K=kernel
|
||||
U=user
|
||||
D=SDK
|
||||
|
||||
CFLAGS_MANDATORY=-DPKG_MKDIR_SIMPLE
|
||||
|
||||
include libc/include.mk
|
||||
|
||||
OBJS = \
|
||||
$K/entry.o \
|
||||
$K/start.o \
|
||||
$K/riscv.o \
|
||||
$K/console.o \
|
||||
$K/kprintf.o \
|
||||
$K/uart.o \
|
||||
$K/physpg.o \
|
||||
$K/spinlock.o \
|
||||
$K/string.o \
|
||||
$K/main.o \
|
||||
$K/vm.o \
|
||||
$K/bitarray.o \
|
||||
$K/proc.o \
|
||||
$K/trampoline.o \
|
||||
$K/trap.o \
|
||||
$K/syscall.o \
|
||||
$K/sysproc.o \
|
||||
$K/drives.o \
|
||||
$K/diskio.o \
|
||||
$K/vmrd.o \
|
||||
$K/fsinstance.o \
|
||||
$K/sleeplock.o \
|
||||
$K/file.o \
|
||||
$K/pipe.o \
|
||||
$K/exec.o \
|
||||
$K/sysfile.o \
|
||||
$K/kernelvec.o \
|
||||
$K/plic.o \
|
||||
$K/virtio_disk.o \
|
||||
$K/sched.o \
|
||||
$K/sysnew.o \
|
||||
$K/fpu.o \
|
||||
$K/asmnew.o \
|
||||
$K/sync.o \
|
||||
$K/schedasm.o
|
||||
|
||||
AUTOGENOBJS = \
|
||||
autogen/res_data.o
|
||||
|
||||
|
||||
# $K/rme_kernel.o \
|
||||
|
||||
# riscv64-unknown-elf- or riscv64-linux-gnu-
|
||||
# perhaps in /opt/riscv/bin
|
||||
#TOOLPREFIX =
|
||||
|
||||
# Try to infer the correct TOOLPREFIX if not set
|
||||
ifndef TOOLPREFIX
|
||||
TOOLPREFIX := $(shell if riscv64-unknown-elf-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-elf-'; \
|
||||
elif riscv64-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-linux-gnu-'; \
|
||||
elif riscv64-unknown-linux-gnu-objdump -i 2>&1 | grep 'elf64-big' >/dev/null 2>&1; \
|
||||
then echo 'riscv64-unknown-linux-gnu-'; \
|
||||
else echo "***" 1>&2; \
|
||||
echo "*** Error: Couldn't find a riscv64 version of GCC/binutils." 1>&2; \
|
||||
echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
|
||||
echo "***" 1>&2; exit 1; fi)
|
||||
endif
|
||||
|
||||
QEMU = qemu-system-riscv64
|
||||
|
||||
#CC = $(TOOLPREFIX)gcc
|
||||
CC = SDK/compilec
|
||||
AS = $(TOOLPREFIX)gas
|
||||
LD = $(TOOLPREFIX)ld
|
||||
OBJCOPY = $(TOOLPREFIX)objcopy
|
||||
OBJDUMP = $(TOOLPREFIX)objdump
|
||||
|
||||
#CFLAGS = -Wall -Werror -O -fno-omit-frame-pointer -ggdb -gdwarf-2
|
||||
#CFLAGS += -MD
|
||||
#CFLAGS += -mcmodel=medany
|
||||
# CFLAGS += -ffreestanding -fno-common -nostdlib -mno-relax
|
||||
#CFLAGS += -fno-common -nostdlib
|
||||
#CFLAGS += -fno-builtin-strncpy -fno-builtin-strncmp -fno-builtin-strlen -fno-builtin-memset
|
||||
#CFLAGS += -fno-builtin-memmove -fno-builtin-memcmp -fno-builtin-log -fno-builtin-bzero
|
||||
#CFLAGS += -fno-builtin-strchr -fno-builtin-exit -fno-builtin-malloc -fno-builtin-putc
|
||||
#CFLAGS += -fno-builtin-free
|
||||
#CFLAGS += -fno-builtin-memcpy -Wno-main
|
||||
#CFLAGS += -fno-builtin-printf -fno-builtin-fprintf -fno-builtin-vprintf
|
||||
CFLAGS = -I. --dynamic $(CFLAGS_MANDATORY)
|
||||
#CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||
|
||||
# Disable PIE when possible (for Ubuntu 16.10 toolchain)
|
||||
#ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),)
|
||||
#CFLAGS += -fno-pie -no-pie
|
||||
#endif
|
||||
#ifneq ($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]nopie'),)
|
||||
#CFLAGS += -fno-pie -nopie
|
||||
#endif
|
||||
|
||||
LDFLAGS = -z max-page-size=4096
|
||||
|
||||
$K/kernel: $(OBJS) $(AUTOGENOBJS) $K/kernel.ld $U/initcode kernel-audit.txt
|
||||
$(LD) $(LDFLAGS) -T $K/kernel.ld -o $K/kernel $(OBJS) $(AUTOGENOBJS)
|
||||
$(OBJDUMP) -S $K/kernel > $K/kernel.asm
|
||||
$(OBJDUMP) -t $K/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $K/kernel.sym
|
||||
|
||||
$K/kernel.bin: $K/kernel
|
||||
$(OBJCOPY) -O binary $K/kernel $K/kernel.bin
|
||||
|
||||
$U/initcode: $U/initcode.S
|
||||
$(CC) $(CFLAGS) -I. -Ikernel -c $U/initcode.S -o $U/initcode.o
|
||||
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o $U/initcode.out $U/initcode.o
|
||||
$(OBJCOPY) -S -O binary $U/initcode.out $U/initcode
|
||||
$(OBJDUMP) -S $U/initcode.o > $U/initcode.asm
|
||||
|
||||
tags: $(OBJS) _init
|
||||
etags *.S *.c
|
||||
|
||||
ULIB = $U/ulib.o $U/usys.o $U/printf.o $U/umalloc.o
|
||||
|
||||
_%: %.o $(ULIB)
|
||||
$(LD) $(LDFLAGS) -T $U/user.ld -o $@ $^
|
||||
$(OBJDUMP) -S $@ > $*.asm
|
||||
$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
|
||||
|
||||
$U/usys.S : $U/usys.pl
|
||||
perl $U/usys.pl > $U/usys.S
|
||||
|
||||
$U/usys.o : $U/usys.S
|
||||
$(CC) $(CFLAGS) -c -o $U/usys.o $U/usys.S
|
||||
|
||||
$U/_forktest: $U/forktest.o $(ULIB)
|
||||
# forktest has less library code linked in - needs to be small
|
||||
# in order to be able to max out the proc table.
|
||||
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $U/_forktest $U/forktest.o $U/ulib.o $U/usys.o
|
||||
$(OBJDUMP) -S $U/_forktest > $U/forktest.asm
|
||||
|
||||
#TODO: test mkfs on new compiler
|
||||
mkfs/mkfs: mkfs/mkfs.c mkfs/mkfsv2.c $K/fs.h $K/param.h
|
||||
gcc -Werror -Wall -I. -o mkfs/mkfs mkfs/mkfs.c
|
||||
|
||||
mkfs/mkfsv2: mkfs/main.c mkfs/mkfsv2.c $K/fs.h $K/param.h
|
||||
gcc -Werror -Wall -I. -o mkfs/mkfsv2 mkfs/main.c
|
||||
|
||||
$D/assemble: $D/compilec $D/assemble.c $D/asmln.c $D/asmln.h $D/asmdata.c $D/asmdata.h $D/asmpp.c $D/asmpp.h
|
||||
$D/compilec -I$D/fakelibc -o $D/assemble $D/assemble.c
|
||||
|
||||
#TODO: Better self-hosting build process
|
||||
$D/compilec: $D/compilec.c $D/brutal.c $D/ccb.h $D/ccbgeneric.h
|
||||
compilec -I$D/fakelibc -o $D/compilec $D/compilec.c
|
||||
|
||||
$D/audit: $D/audit.c $D/compilec
|
||||
$D/compilec -I$D/fakelibc -o $D/audit $D/audit.c
|
||||
|
||||
$D/res2c: $D/res2c.c $D/compilec
|
||||
$D/compilec -I$D/fakelibc -o $D/res2c $D/res2c.c
|
||||
|
||||
$D/srve: $D/srve.c $D/srve.h $D/srve_core.h $D/srve_core_h.h $D/srve_core_c.h $D/compilec
|
||||
$D/compilec -I$D/fakelibc -o $D/srve $D/srve.c
|
||||
|
||||
pkg/pkg: pkg/pkg.c $D/compilec
|
||||
$D/compilec -I$D/fakelibc -DPKG_MKDIR_LINUX -o pkg/pkg pkg/pkg.c
|
||||
|
||||
pkg/dist/pkg: pkg/_libc_pkg
|
||||
cp $< $@
|
||||
|
||||
pkg/pkg.pkg: pkg/pkg pkg/pkg.pkb pkg/dist/pkg
|
||||
pkg/pkg build pkg/pkg.pkb
|
||||
|
||||
kernel-audit.txt: $D/audit $(OBJS) libc/elf.h libc/string.c mkfs/fsformat.h
|
||||
$D/audit kernel/*.c kernel/*.h kernel/*.S libc/elf.h libc/string.c mkfs/fsformat.h > kernel-audit.txt
|
||||
|
||||
# Prevent deletion of intermediate files, e.g. cat.o, after first build, so
|
||||
# that disk image changes after first build are persistent until clean. More
|
||||
# details:
|
||||
# http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
|
||||
.PRECIOUS: %.o
|
||||
|
||||
UPROGS=\
|
||||
$U/_cat\
|
||||
$U/_echo\
|
||||
$U/_forktest\
|
||||
$U/_thrdtest\
|
||||
$U/_grep\
|
||||
$U/_init\
|
||||
$U/_kill\
|
||||
$U/_ln\
|
||||
$U/_ls\
|
||||
$U/_mkdir\
|
||||
$U/_rm\
|
||||
$U/_sh\
|
||||
$U/_stressfs\
|
||||
$U/_grind\
|
||||
$U/_wc\
|
||||
$U/_zombie\
|
||||
$U/_libc_drives\
|
||||
$U/_libc_st\
|
||||
$D/_numbered\
|
||||
$D/_libc_assemble\
|
||||
$D/_libc_compilec\
|
||||
$D/_libc_hello\
|
||||
$D/_libc_audit\
|
||||
$D/_libc_res2c\
|
||||
AI/_libc_example1\
|
||||
$U/_libc_scm\
|
||||
pkg/_libc_pkg
|
||||
|
||||
|
||||
# $U/_usertests\
|
||||
|
||||
st.o: SDK/compilec user/st.c
|
||||
SDK/compilec -I SDK/fakelibc -c -ost.o user/st.c
|
||||
|
||||
st: st.o
|
||||
gcc -ost st.o -lm
|
||||
|
||||
fs.img: mkfs/mkfsv2 README $U/classic.st pkg/pkg.pkg $(UPROGS)
|
||||
mkfs/mkfsv2 -v1 --skip_underscores --output fs.img --blocksize 4096 --blocks 2000 README $U/classic.st pkg/pkg.pkg $(UPROGS) snapshot
|
||||
|
||||
ramdisk0.img: mkfs/mkfsv2 README
|
||||
mkfs/mkfsv2 -v0 --blocksize 4096 --output ramdisk0.img --blocks 500 README
|
||||
|
||||
ramdisk1.img: mkfs/mkfsv2 README
|
||||
mkfs/mkfsv2 -v1 --blocksize 4096 --output ramdisk1.img --blocks 800 README SDK/rv64.inc SDK/*.c SDK/*.h
|
||||
|
||||
imgsums.txt: ramdisk0.img ramdisk1.img
|
||||
md5sum $^ > imgsums.txt
|
||||
|
||||
autogen/res_data.c: $D/res2c ramdisk0.img ramdisk1.img
|
||||
$D/res2c --output autogen/res_data.c --type RAMDISK --filename RD0 ramdisk0.img --type RAMDISK --filename RD1 ramdisk1.img
|
||||
|
||||
-include kernel/*.d user/*.d
|
||||
|
||||
clean:
|
||||
rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
|
||||
*/*.o */*.d */*.asm */*.sym \
|
||||
$U/initcode $U/initcode.out $K/kernel fs.img \
|
||||
mkfs/mkfs mkfs/mkfsv2 $D/assemble $D/compilec $D/audit $D/res2c .gdbinit \
|
||||
ramdisk0.img ramdisk1.img imgsums.txt \
|
||||
$U/usys.S \
|
||||
$(UPROGS)
|
||||
|
||||
# try to generate a unique GDB port
|
||||
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
|
||||
# QEMU's gdb stub command line changed in 0.11
|
||||
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
|
||||
then echo "-gdb tcp::$(GDBPORT)"; \
|
||||
else echo "-s -p $(GDBPORT)"; fi)
|
||||
ifndef CPUS
|
||||
CPUS := 3
|
||||
endif
|
||||
|
||||
QEMUOPTS = -machine virt -bios none -kernel $K/kernel -m 128M -smp $(CPUS) -nographic
|
||||
QEMUOPTS += -global virtio-mmio.force-legacy=false
|
||||
QEMUOPTS += -drive file=fs.img,if=none,format=raw,id=x0
|
||||
QEMUOPTS += -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 -accel tcg
|
||||
# Some more options just for testing
|
||||
QEMUOPTS += -object memory-backend-file,id=shmem0,mem-path=foo,size=1M,share=on
|
||||
QEMUOPTS += -device ivshmem-plain,memdev=shmem0,bus=pcie.0,addr=0x2.0
|
||||
|
||||
qemu: imgsums.txt $K/kernel fs.img
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
.gdbinit: .gdbinit.tmpl-riscv
|
||||
sed "s/:1234/:$(GDBPORT)/" < $^ > $@
|
||||
|
||||
qemu-gdb: $K/kernel .gdbinit fs.img
|
||||
@echo "*** Now run 'gdb' in another window." 1>&2
|
||||
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)
|
||||
|
1
slabpkg
Submodule
1
slabpkg
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7642a79c02a11de026775b64516a3071f966664f
|
1
slbldtls
Submodule
1
slbldtls
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5ec6023a027c34edc70b50ff872e966c0e3dd619
|
1
slkern
Submodule
1
slkern
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c0efdc3b0f626ad000d4cceb7e3825d68ef249a7
|
1
sllibc
Submodule
1
sllibc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1ed9e8eeab100f1c60332ed1242a0697484e6b37
|
1
sllul
Submodule
1
sllul
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit de71bc79e468ef5812b2b7ed950aeffa3af93f93
|
1
slmkfs
Submodule
1
slmkfs
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d202ee3ce157912df66405887b34e526005e8851
|
Loading…
x
Reference in New Issue
Block a user