#! /usr/bin/env bash # SPDX-FileCopyrightText: 2022 Andrius Štikonas # SPDX-FileCopyrightText: 2017 Jeremiah Orians # SPDX-FileCopyrightText: 2017 Jan Nieuwenhuizen # # SPDX-License-Identifier: GPL-3.0-or-later ################################# # Phase-1 Build hex1 from hex0 # ################################# 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 ################################# # Phase-2 Build hex2 from hex1 # ################################# amd64\artifact\hex1.efi amd64\hex2.hex1 amd64\artifact\hex2-0.efi # 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. ################################# # 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 ############################### # 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 ################################### # 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 ######################################### # Phase-5 Build M2-Planet from cc_amd64 # ######################################### 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 amd64\artifact\cc_amd64.efi amd64\artifact\M2-0.c amd64\artifact\M2-0.M1 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 amd64\artifact\M0.efi amd64\artifact\M2-0-0.M1 amd64\artifact\M2-0.hex2 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 # 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 # ####################################### 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\sys\utsname.h -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 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 # ################################### 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/sys/utsname.h -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 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 # ##################################### 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/sys/utsname.h -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 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 ###################################### # Phase-10 Build kaem from C sources # ###################################### 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/sys/utsname.h -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 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