stage0/Linux Bootstrap/x86/kaem.run

119 lines
4.5 KiB
Bash

#!/usr/bin/env bash
## Copyright (C) 2017 Jeremiah Orians
## This file is part of mescc-tools.
##
## mescc-tools is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## mescc-tools is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with mescc-tools. If not, see <http://www.gnu.org/licenses/>.
# kaem build file for bootstrapping
# Build bin folder for binaries
mkdir -p ../bin
################################
# ROOT BINARY #
################################
# nasm bootstrap of the hex0 root binary
# Feel free to substitute with any method you choose
nasm -felf32 hex0_x86.S -o ../bin/hex0-0.o
ld -melf_i386 ../bin/hex0-0.o -o ../bin/hex0-0
################################
# hex0 #
################################
# Using the bootstrap seed to build our root hex0
../bin/hex0-0 hex0_x86.hex0 ../bin/hex0
# Its sha256sum SHOULD be 59f8b53649e82add0904c36c3a667f7fbd127e75c27cbf51362f4f4106679fca
# Should you wish to verify the self-host
# If if you run:
# ../bin/hex0 hex0_x86.hex0 temp1
# ./temp1 hex0_x86.hex0 temp2
# they both should have exactly the same checksum as the hex0 binary (unless you changed the hex0 code in that input file)
################################
# catm #
################################
# Should you wish to build the catm via the NASM sources run:
# nasm -felf32 catm_x86.S -o ../bin/catm-0.o
# ld -melf_i386 ../bin/catm-0.o -o ../bin/catm-0
# otherwise you can use the hex0 we built in the previous step to build catm
../bin/hex0 catm_x86.hex0 ../bin/catm
# Its sha256sum SHOULD be 86cfcce7adcdf3a86b6bc42b658ed9ab00d9c23120cfe72463dce405fdb958d2
# Should you wish to build it from the M1 source
# ../bin/M0 catm_x86.M1 hold
# catm hold2 ../elf_headers/elf32.hex2 hold
# ../bin/hex2 hold2 temp1
# Which should perfectly match the catm_x86.hex0 binary
################################
# hex1 #
################################
# Should you wish to build the hex1 via the NASM sources run:
# nasm -felf32 hex1_x86.S -o ../bin/hex1-0.o
# ld -melf_i386 ../bin/hex1-0.o -o ../bin/hex1-0
# otherwise you can use the hex0 we built in the previous step to bootstrap hex1
../bin/hex0 hex1_x86.hex0 ../bin/hex1
# Its sha256sum SHOULD be 90ab907fc7208b67e3c47f4c1275c4f5d7fff1351e68df8517524ad9f57bfa73
# Should you wish to verify the self-host
# If if you run:
# ../bin/hex1 hex1_x86.hex1 temp1
# ./temp1 hex1_x86.hex1 temp2
# they both should have exactly the same checksum as the hex1 binary (unless you changed the hex1 code in that input file)
################################
# hex2 #
################################
# Should you wish to build the hex2 via the NASM sources run:
# nasm -felf32 hex2_x86.S -o ../bin/hex2-0.o
# ld -melf_i386 ../bin/hex2-0.o -o ../bin/hex2-0
# otherwise you can use the hex1 we built in the previous step to bootstrap hex2
../bin/hex1 hex2_x86.hex1 ../bin/hex2
# Its sha256sum SHOULD be 7a4eea205df9ee165705de44503c8b25f4ce57ac95593b3170696fb280c84822
# Should you wish to verify the self-host
# If if you run:
# ../bin/catm hold ../elf_headers/elf32.hex2 hex2_x86.hex2
# ../bin/hex2 hold temp1
# ./temp1 hold temp2
# they both should have exactly the same checksum as the hex2 binary (unless you changed the hex2 code in that input file or the elf header)
################################
# M0 #
################################
# Should you wish to build the M0 via the NASM sources run:
# nasm -felf32 M0_x86.S -o ../bin/M0-0.o
# ld -melf_i386 ../bin/M0-0.o -o ../bin/M0-0
# otherwise you can use the hex1 we built in the previous step to bootstrap hex2
../bin/catm hold ../elf_headers/elf32.hex2 M0_x86.hex2
../bin/hex2 hold ../bin/M0
# Its sha256sum SHOULD be 0d1434267181f0725b99f0200ec4953d04fedd150e883b4fb0310124a050a86b
# Should you wish to verify the self-host
# If if you run:
# ../bin/M0 M0_x86.M1 hold
# ../bin/catm hold2 ../elf_headers/elf32.hex2 hold
# ../bin/hex2 hold2 temp1
# ./temp1 M0_x86.M1 temp2
# they both should have exactly the same checksum as the M0 binary (unless you changed the M0 code in that input file or the hex2 of the elf header)