2022-11-26 18:26:19 +00:00
|
|
|
#! /usr/bin/env bash
|
2022-08-07 11:30:42 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
2022-08-09 20:04:52 +01:00
|
|
|
# SPDX-FileCopyrightText: 2017 Jeremiah Orians
|
2022-12-08 21:22:07 +00:00
|
|
|
# SPDX-FileCopyrightText: 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
2022-08-07 11:30:42 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#################################
|
|
|
|
# Phase-1 Build hex1 from hex0 #
|
|
|
|
#################################
|
2022-08-09 20:04:52 +01:00
|
|
|
amd64\artifact\hex0.efi amd64\hex1.hex0 amd64\artifact\hex1.efi
|
|
|
|
# hex1 adds support for single character labels and is available in various forms
|
|
|
|
# in mescc-tools/amd64_bootstrap to allow you various ways to verify correctness
|
2022-08-13 20:57:36 +01:00
|
|
|
|
|
|
|
#################################
|
|
|
|
# Phase-2 Build hex2 from hex1 #
|
|
|
|
#################################
|
2022-09-01 01:00:56 +01:00
|
|
|
amd64\artifact\hex1.efi amd64\hex2.hex1 amd64\artifact\hex2-0.efi
|
2022-08-13 20:57:36 +01:00
|
|
|
# hex2 adds support for long labels and absolute addresses thus allowing it
|
|
|
|
# to function as an effective linker for later stages of the bootstrap
|
|
|
|
# This is a minimal version which will be used to bootstrap a much more advanced
|
|
|
|
# version in a later stage.
|
2022-08-14 22:31:13 +01:00
|
|
|
|
|
|
|
#################################
|
|
|
|
# Phase-2b Build catm from hex2 #
|
|
|
|
#################################
|
|
|
|
amd64\artifact\hex2-0.efi amd64\catm.hex2 amd64\artifact\catm.efi
|
|
|
|
# catm removes the need for cat or shell support for redirection by providing
|
|
|
|
# equivalent functionality via catm output_file input1 input2 ... inputN
|
2022-09-25 23:00:52 +01:00
|
|
|
|
|
|
|
###############################
|
|
|
|
# Phase-3 Build M0 from hex2 #
|
|
|
|
###############################
|
|
|
|
amd64\artifact\catm.efi amd64\artifact\M0.hex2 amd64\PE32-amd64.hex2 amd64\M0.hex2
|
|
|
|
amd64\artifact\hex2-0.efi amd64\artifact\M0.hex2 amd64\artifact\M0.efi
|
|
|
|
# M0 is the architecture specific version of M1 and is by design single
|
|
|
|
# architecture only and will be replaced by the C code version of M1
|
2022-10-06 22:49:54 +01:00
|
|
|
|
|
|
|
###################################
|
|
|
|
# Phase-4 Build cc_amd64 from M0 #
|
|
|
|
###################################
|
|
|
|
amd64\artifact\M0.efi amd64\cc_amd64.M1 amd64\artifact\cc_amd64.hex2
|
|
|
|
amd64\artifact\catm.efi amd64\artifact\cc_amd64-0.hex2 amd64\PE32-amd64.hex2 amd64\artifact\cc_amd64.hex2
|
|
|
|
amd64\artifact\hex2-0.efi amd64\artifact\cc_amd64-0.hex2 amd64\artifact\cc_amd64.efi
|
2022-10-11 00:13:04 +01:00
|
|
|
|
|
|
|
#########################################
|
|
|
|
# Phase-5 Build M2-Planet from cc_amd64 #
|
|
|
|
#########################################
|
2022-10-26 23:09:37 +01:00
|
|
|
amd64\artifact\catm.efi amd64\artifact\M2-0.c M2libc\amd64\uefi\bootstrap.c M2-Planet\cc.h M2libc\bootstrappable.c M2-Planet\cc_globals.c M2-Planet\cc_reader.c M2-Planet\cc_strings.c M2-Planet\cc_types.c M2-Planet\cc_core.c M2-Planet\cc_macro.c M2-Planet\cc.c
|
2022-10-11 00:13:04 +01:00
|
|
|
amd64\artifact\cc_amd64.efi amd64\artifact\M2-0.c amd64\artifact\M2-0.M1
|
2022-10-26 23:09:37 +01:00
|
|
|
amd64\artifact\catm.efi amd64\artifact\M2-0-0.M1 M2libc\amd64\amd64_defs.M1 M2libc\amd64\uefi\libc-core.M1 amd64\artifact\M2-0.M1
|
2022-10-11 00:13:04 +01:00
|
|
|
amd64\artifact\M0.efi amd64\artifact\M2-0-0.M1 amd64\artifact\M2-0.hex2
|
2022-10-26 23:09:37 +01:00
|
|
|
amd64\artifact\catm.efi amd64\artifact\M2-0-0.hex2 amd64\PE32-amd64.hex2 amd64\artifact\M2-0.hex2
|
|
|
|
amd64\artifact\hex2-0.efi amd64\artifact\M2-0-0.hex2 amd64\artifact\M2.efi
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Phase-6 Build M1-0 from C sources #
|
|
|
|
#####################################
|
|
|
|
amd64\artifact\M2.efi --architecture amd64 -f M2libc\amd64\uefi\bootstrap.c -f M2libc\bootstrappable.c -f mescc-tools\stringify.c -f mescc-tools\M1-macro.c --bootstrap-mode -o amd64\artifact\M1-macro-0.M1
|
|
|
|
amd64\artifact\catm.efi amd64\artifact\M1-macro-0-0.M1 M2libc\amd64\amd64_defs.M1 M2libc\amd64\uefi\libc-core.M1 amd64\artifact\M1-macro-0.M1
|
|
|
|
amd64\artifact\M0.efi amd64\artifact\M1-macro-0-0.M1 amd64\artifact\M1-macro-0.hex2
|
|
|
|
amd64\artifact\catm.efi amd64\artifact\M1-macro-0-0.hex2 M2libc\amd64\uefi\PE32-amd64.hex2 amd64\artifact\M1-macro-0.hex2
|
|
|
|
amd64\artifact\hex2-0.efi amd64\artifact\M1-macro-0-0.hex2 amd64\artifact\M1-0.efi
|
2022-11-26 18:26:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
# This is the last stage where catm will need to be used and the last stage where
|
|
|
|
# M0 is used, as we will being using it's much more powerful and cross-platform
|
|
|
|
# version with a bunch of extra goodies.
|
|
|
|
# We are also switching to a more powerful C library that supports more of the POSIX standard.
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# Phase-7 Build hex2-1 from C sources #
|
|
|
|
#######################################
|
2022-12-31 17:20:13 +00:00
|
|
|
amd64\artifact\M2.efi --architecture amd64 -f M2libc\sys\types.h -f M2libc\stddef.h -f M2libc\uefi\uefi.c -f M2libc\string.c -f M2libc\uefi\fcntl.c -f M2libc\fcntl.c -f M2libc/stdio.h -f M2libc\stdio.c -f M2libc\uefi\unistd.c -f M2libc\uefi\sys\stat.c -f M2libc\stdlib.c -f M2libc\ctype.c -f M2libc\bootstrappable.c -f mescc-tools\hex2.h -f mescc-tools\hex2_linker.c -f mescc-tools\hex2_word.c -f mescc-tools\hex2.c -o amd64\artifact\hex2_linker-1.M1
|
2022-11-26 18:26:19 +00:00
|
|
|
|
|
|
|
amd64\artifact\M1-0.efi --architecture amd64 --little-endian -f M2libc\amd64\amd64_defs.M1 -f M2libc\amd64\uefi\libc-full.M1 -f amd64\artifact\hex2_linker-1.M1 -o amd64\artifact\hex2_linker-1.hex2
|
|
|
|
|
|
|
|
amd64\artifact\catm.efi amd64\artifact\hex2_linker-1-0.hex2 M2libc\amd64\uefi\PE32-amd64.hex2 amd64\artifact\hex2_linker-1.hex2
|
|
|
|
|
|
|
|
amd64\artifact\hex2-0.efi amd64\artifact\hex2_linker-1-0.hex2 amd64\artifact\hex2-1.efi
|
|
|
|
|
|
|
|
# This is the last stage where we will be using the handwritten hex2 and instead
|
|
|
|
# be using the far more powerful, cross-platform version with a bunch more goodies
|
|
|
|
|
|
|
|
###################################
|
|
|
|
# Phase-8 Build M1 from C sources #
|
|
|
|
###################################
|
2022-12-31 17:20:13 +00:00
|
|
|
amd64\artifact\M2.efi --architecture amd64 -f M2libc/sys/types.h -f M2libc/stddef.h -f M2libc/uefi/uefi.c -f M2libc/string.c -f M2libc/uefi/fcntl.c -f M2libc/fcntl.c -f M2libc/stdio.h -f M2libc/stdio.c -f M2libc/uefi/unistd.c -f M2libc/uefi/sys/stat.c -f M2libc/stdlib.c -f M2libc/ctype.c -f M2libc/bootstrappable.c -f mescc-tools/stringify.c -f mescc-tools/M1-macro.c -o amd64/artifact/M1-macro-1.M1
|
2022-11-26 18:26:19 +00:00
|
|
|
|
|
|
|
amd64\artifact\M1-0.efi --architecture amd64 --little-endian -f M2libc/amd64/amd64_defs.M1 -f M2libc/amd64/uefi/libc-full.M1 -f amd64/artifact/M1-macro-1.M1 -o amd64/artifact/M1-macro-1.hex2
|
|
|
|
|
|
|
|
amd64\artifact\hex2-1.efi --architecture amd64 --little-endian -f M2libc/amd64/uefi/PE32-amd64.hex2 -f amd64/artifact/M1-macro-1.hex2 -o amd64/bin/M1.efi
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Phase-9 Build hex2 from C sources #
|
|
|
|
#####################################
|
2022-12-31 17:20:13 +00:00
|
|
|
amd64\artifact\M2.efi --architecture amd64 -f M2libc/sys/types.h -f M2libc/stddef.h -f M2libc/uefi/uefi.c -f M2libc/string.c -f M2libc/uefi/fcntl.c -f M2libc/fcntl.c -f M2libc/stdio.h -f M2libc/stdio.c -f M2libc/uefi/unistd.c -f M2libc/uefi/sys/stat.c -f M2libc/stdlib.c -f M2libc/ctype.c -f M2libc/bootstrappable.c -f mescc-tools/hex2.h -f mescc-tools/hex2_linker.c -f mescc-tools/hex2_word.c -f mescc-tools/hex2.c -o amd64/artifact/hex2_linker-2.M1
|
2022-11-26 18:26:19 +00:00
|
|
|
|
|
|
|
amd64\bin\M1.efi --architecture amd64 --little-endian -f M2libc/amd64/amd64_defs.M1 -f M2libc/amd64/uefi/libc-full.M1 -f amd64/artifact/hex2_linker-2.M1 -o amd64/artifact/hex2_linker-2.hex2
|
|
|
|
|
|
|
|
amd64\artifact\hex2-1.efi --architecture amd64 --little-endian -f M2libc/amd64/uefi/PE32-amd64.hex2 -f amd64/artifact/hex2_linker-2.hex2 -o amd64/bin/hex2.efi
|
2022-11-26 18:34:44 +00:00
|
|
|
|
|
|
|
######################################
|
|
|
|
# Phase-10 Build kaem from C sources #
|
|
|
|
######################################
|
2022-12-31 17:20:13 +00:00
|
|
|
amd64\artifact\M2.efi --architecture amd64 -f M2libc/sys/types.h -f M2libc/stddef.h -f M2libc/uefi/uefi.c -f M2libc/string.c -f M2libc/uefi/fcntl.c -f M2libc/fcntl.c -f M2libc/stdio.h -f M2libc/stdio.c -f M2libc/uefi/unistd.c -f M2libc/uefi/sys/stat.c -f M2libc/stdlib.c -f M2libc/ctype.c -f M2libc/bootstrappable.c -f mescc-tools/Kaem/kaem.h -f mescc-tools/Kaem/variable.c -f mescc-tools/Kaem/kaem_globals.c -f mescc-tools/Kaem/kaem.c -o amd64/artifact/kaem.M1
|
2022-11-26 18:34:44 +00:00
|
|
|
|
|
|
|
amd64\bin\M1.efi --architecture amd64 --little-endian -f M2libc/amd64/amd64_defs.M1 -f M2libc/amd64/uefi/libc-full.M1 -f amd64/artifact/kaem.M1 -o amd64/artifact/kaem.hex2
|
|
|
|
|
|
|
|
amd64\bin\hex2.efi --architecture amd64 --little-endian -f M2libc/amd64/uefi/PE32-amd64.hex2 -f amd64/artifact/kaem.hex2 -o amd64/bin/kaem.efi
|