Refactor builds to use target profiles and discovery; remove architecture checker
This commit is contained in:
1 parent
6a1eb5e2ac
commit
7a6be7f66e
15 files changed
+238
-232
No files matched your search
+27
-26
@@ -1,31 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Multi-architecture build updates: Copyright 2026 Aaron Hance.
|
||||
# Copyright 2026 Aaron Hance
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
set -e
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/target.sh"
|
||||
echo " "
|
||||
echo "======================="
|
||||
echo " "
|
||||
echo "Linking..."
|
||||
echo " "
|
||||
if [ "$ASURO_ARCH" = x86_64 ]; then
|
||||
ld -m "$LD_FORMAT" --gc-sections --no-warn-execstack \
|
||||
-T"$LINKER_SCRIPT" -o "$BIN_DIR/kernel.bin" "$OBJ_DIR/"*.o
|
||||
grub-file --is-x86-multiboot "$BIN_DIR/kernel.bin"
|
||||
exit
|
||||
objects=()
|
||||
boot_object="$OBJ_DIR/${ASM_ENTRY//\//_}"
|
||||
boot_object="${boot_object%.asm}.o"
|
||||
objects+=("$boot_object")
|
||||
while IFS= read -r -d '' object; do
|
||||
if [ "$object" != "$boot_object" ]; then objects+=("$object"); fi
|
||||
done < <(find "$OBJ_DIR" -maxdepth 1 -type f -name '*.o' -print0 | LC_ALL=C sort -z)
|
||||
libraries=()
|
||||
while IFS= read -r -d '' library; do libraries+=("$library"); done \
|
||||
< <(find "$OBJ_DIR" -maxdepth 1 -type f -name '*.a' -print0 | LC_ALL=C sort -z)
|
||||
if "$LINK_COMPILER_RUNTIME"; then
|
||||
libraries+=("$("$C_COMPILER" "${C_TARGET_OPTIONS[@]}" -print-libgcc-file-name)")
|
||||
fi
|
||||
objstring="";
|
||||
for object in `find lib/ -maxdepth 1 -name "*.o"`; do
|
||||
if [ "$object" != "lib/stub.o" ]
|
||||
then
|
||||
objstring=$objstring$object" ";
|
||||
fi
|
||||
done;
|
||||
objstring=lib/stub.o" "$objstring
|
||||
echo "Object Files: "$objstring
|
||||
echo " "
|
||||
|
||||
# Find libgcc for i386 (needed by LVGL compiled with gcc)
|
||||
LIBGCC=$(gcc -m32 -print-libgcc-file-name)
|
||||
echo "libgcc: ${LIBGCC}"
|
||||
|
||||
ld -m elf_i386 -s --gc-sections --no-warn-execstack -Ttoolchain/linker.script -o bin/kernel.bin $objstring --start-group lib/liblvgl.a ${LIBGCC} --end-group
|
||||
ld -m "$LD_FORMAT" "${LINK_OPTIONS[@]}" --gc-sections --no-warn-execstack \
|
||||
-T"$LINKER_SCRIPT" -o "$BIN_DIR/kernel.bin" "${objects[@]}" \
|
||||
--start-group "${libraries[@]}" --end-group
|
||||
"${KERNEL_VALIDATOR[@]}" "$BIN_DIR/kernel.bin"
|
||||
Reference in new issue
Block a user