Close the Shanghai experiment without denying the existing Zhuyuan subject, parameterize the native layout for the JD Cloud disk, and add fail-closed one-time probe preparation, arming, and return verification.
32 lines
1.1 KiB
Shell
Executable file
32 lines
1.1 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
[[ $# -eq 2 ]] || {
|
|
echo "usage: build-native-resident-candidate.sh <world-root> <output-directory>" >&2
|
|
exit 64
|
|
}
|
|
|
|
world_root=$(readlink -f "$1")
|
|
output_root=$(readlink -m "$2")
|
|
source_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
native_root=${source_root}/native/x86_64-bios
|
|
|
|
command -v nasm >/dev/null
|
|
mkdir -p "${output_root}"
|
|
cargo run --quiet --manifest-path "${source_root}/Cargo.toml" \
|
|
-p hldp-native-compiler -- "${world_root}" "${output_root}/world.inc"
|
|
layout_args=()
|
|
while IFS= read -r argument; do layout_args+=("${argument}"); done \
|
|
< <("${source_root}/scripts/native-layout-nasm-args.sh" "${world_root}")
|
|
(
|
|
cd "${output_root}"
|
|
nasm -f bin -I "${output_root}/" -I "${native_root}/" \
|
|
"${layout_args[@]}" \
|
|
-dGHOS_PHYSICAL_CANDIDATE=1 \
|
|
-dGHOS_NATIVE_RESIDENT=1 \
|
|
"${native_root}/boot.asm" \
|
|
-o guanghu-os-x86_64-bios-resident.img
|
|
)
|
|
[[ $(stat -c %s "${output_root}/guanghu-os-x86_64-bios-resident.img") -eq 14848 ]]
|
|
sha256sum "${output_root}/guanghu-os-x86_64-bios-resident.img" \
|
|
>"${output_root}/guanghu-os-x86_64-bios-resident.img.sha256"
|