Initial commit

This commit is contained in:
Thomas Lovén 2022-01-02 16:49:01 +01:00
commit fdcb46d6f2
10 changed files with 134 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist/
build/
sysroot/

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
ifeq ($(BUILDROOT),)
$(error BUILDROOT IS NOT SET!)
endif
SYSROOT := $(BUILDROOT)/sysroot
DIST := $(BUILDROOT)/dist/mittos.iso
$(DIST):
grub-mkrescue -o $@ $(SYSROOT)
install: $(DIST)
.PHONY: install

3
dbg Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose -f toolchain/docker-compose.yml run --rm dbg "$@"

3
emu Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose -f toolchain/docker-compose.yml run --rm --name emul emul "$@"

3
make Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker-compose -f toolchain/docker-compose.yml run --rm make "$@"

View File

@ -0,0 +1,11 @@
FROM alpine
ADD build-toolchain.sh /opt/build-toolchain.sh
RUN /opt/build-toolchain.sh
ENV PATH "/opt/toolchain:$PATH"
ENV MITTOS64 "true"
ENV BUILDROOT "/opt"
WORKDIR /opt

8
toolchain/Dockerfile.run Normal file
View File

@ -0,0 +1,8 @@
FROM alpine
RUN apk --update --no-cache add qemu-system-x86_64 qemu-ui-curses gdb && rm -rf /var/cache/apk/*
ENV MITTOS64 "true"
ENV BUILDROOT "/opt"
WORKDIR "/opt"

44
toolchain/build-toolchain.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh -e
apk --update add build-base
apk add gmp-dev mpfr-dev mpc1-dev
apk add make
apk add grub-bios xorriso
rm -rf /var/cache/apk/*
target=x86_64-elf
binutils=binutils-2.37
gcc=gcc-11.2.0
cd /opt
wget http://ftp.gnu.org/gnu/binutils/${binutils}.tar.gz
tar -xf ${binutils}.tar.gz
mkdir binutils-build && cd binutils-build
../${binutils}/configure \
--target=${target} \
--disable-nls \
--disable-werror \
--with-sysroot \
make -j 4
make install
cd /opt
wget http://ftp.gnu.org/gnu/gcc/${gcc}/${gcc}.tar.gz
tar -xf ${gcc}.tar.gz
mkdir gcc-build && cd gcc-build
../${gcc}/configure \
--target=${target} \
--disable-nls \
--enable-languages=c \
--without-headers \
make all-gcc all-target-libgcc -j 4
make install-gcc install-target-libgcc
apk del build-base
cd /
rm -rf /opt

View File

@ -0,0 +1,29 @@
version: "3.5"
services:
make:
image: thomasloven/mittos-build
build:
context: .
dockerfile: Dockerfile.build
volumes:
- ..:/opt
command: make
emul:
image: thomasloven/mittos-run
build:
context: .
dockerfile: Dockerfile.run
volumes:
- ..:/opt
command: qemu-system-x86_64 -s -S -cdrom /opt/dist/mittos.iso -curses
dbg:
image: thomasloven/mittos-run
build:
context: .
dockerfile: Dockerfile.run
volumes:
- ..:/opt
command: gdb -q -x /opt/toolchain/gdbinit

16
toolchain/gdbinit Normal file
View File

@ -0,0 +1,16 @@
set prompt \033[31m(gdb) \033[0m
set disassembly-flavor intel
target remote emul:1234
define q
monitor quit
end
define reg
monitor info registers
end
define reset
monitor system_reset
end