From bc67731f82cd6cebaf51529e9610bacb1a7c07ef Mon Sep 17 00:00:00 2001 From: Andreas Bauman Date: Thu, 5 Apr 2018 16:00:25 +0200 Subject: tested on old OS X 10.8 with Macports --- doc/HOWTO.OSX | 23 +++++++++++++++++++---- src/Makefile | 5 +++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/HOWTO.OSX b/doc/HOWTO.OSX index 326cb70..90c1aed 100644 --- a/doc/HOWTO.OSX +++ b/doc/HOWTO.OSX @@ -1,17 +1,28 @@ Followed: http://wiki.osdev.org/How_to_develop_on_Mac_OS_X -brew uninstall binutils + lynx ftp://ftp.gnu.org/gnu/binutils/ lynx ftp://ftp.gnu.org/gnu/gcc/ tar zxvf binutils-2.28.tar.gz tar zxvf gcc-6.3.0.tar.gz cd gcc-6.3.0 contrib/download_prerequisites + +# new MacOS (brew) +brew uninstall binutils brew install gcc export CC=/usr/local/bin/gcc-6 export CXX=/usr/local/bin/g++-6 export CPP=/usr/local/bin/cpp-6 export LD=/usr/local/bin/gcc-6 + +# old MacOS (macports) +sudo port install gcc +sudo port select --set gcc mp-gcc7 +export CC=/opt/local/bin/gcc +export CXX=/opt/local/bin/g++ +export CPP=/opt/local/bin/cpp +export LD=/opt/local/bin/gcc export PREFIX="$HOME/opt/cross" export TARGET=i486-elf export PATH="$PREFIX/bin:$PATH" @@ -21,16 +32,20 @@ mv gcc-6.3.0* src cd src/ mkdir build-binutils cd build-binutils -../binutils-2.28/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror +../binutils-2.28/configure --target=$TARGET --prefix="$PREFIX" \ + --with-sysroot --disable-nls --disable-werror make make install which -- $TARGET-as || echo $TARGET-as is not in the PATH mkdir build-gcc cd build-gcc -../gcc-6.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers +../gcc-6.3.0/configure --target=$TARGET --prefix="$PREFIX" \ + --disable-nls --enable-languages=c,c++ --without-headers make all-gcc make all-target-libgcc make install-gcc make install-target-libgcc -make CC=~/opt/cross/bin/i486-elf-gcc LD=~/opt/cross/bin/i486-elf-ld +make TRUNCATE=gtruncate OBJCOPY=~/opt/cross/bin/i486-elf-objcopy \ + CC=~/opt/cross/bin/i486-elf-gcc LD=~/opt/cross/bin/i486-elf-ld \ + clean all run-qemu diff --git a/src/Makefile b/src/Makefile index 0817887..96acb38 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,6 +9,7 @@ NASMFLAGS := -f elf32 NASM := nasm OBJCOPY := objcopy MAGIC := $(shell printf '%x' `date +%s`) +TRUNCATE := truncate all: image.bin kernel.sym @@ -23,9 +24,9 @@ all: image.bin kernel.sym # on the size of the image) image.bin: boot.bin kernel.bin magic.bin cat boot.bin kernel.bin > image.tmp - truncate -s 89088 image.tmp + $(TRUNCATE) -s 89088 image.tmp cat image.tmp magic.bin > image.bin - truncate -s 1474560 image.bin + $(TRUNATE) -s 1474560 image.bin boot.bin: boot/boot.asm boot/boot_gdt.asm boot/stage1_functions.asm boot/stage2_real_functions.asm boot/stage2_pm_functions.asm boot/stage2_switch_mode.asm boot/stage2_a20.asm $(NASM) boot/boot.asm -DMAGIC='"$(MAGIC)"' -f bin -o boot.bin -- cgit v1.2.3-54-g00ecf