-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove concept of make configure; we know have simple FS
- Loading branch information
1 parent
edc4228
commit 825e43f
Showing
7 changed files
with
50 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
*.vmdk | ||
*.o | ||
configure | ||
local_notes/ | ||
build/ | ||
src_test/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,50 @@ | ||
#!/bin/bash | ||
# The scripts take multiple subimages as argument and prepare final image | ||
# by merging them. Once successful echo's sub images size. | ||
# The scripts take essential subimages as argument merging them while verifying their size. | ||
|
||
set -e | ||
if [ $# -lt 2 ] ; then | ||
echo "Usage: build_image.sh <target_image> <subimage1> [ <subimage2> ... ]" >&2 | ||
if [ $# -ne 9 ] ; then | ||
echo "Usage: build_image.sh <target_image> <bt_stage1> <sc> <realmode_lib> <sc> <bt_stage2> <sc> <kernel> <sc>" | ||
echo "<sc> is sector count of preceding subimage." | ||
exit 1 | ||
fi | ||
|
||
# Currently image is build in two phases. | ||
# Phase 1: | ||
# Build image with undefined SECTOR index which can be used to calculate | ||
# SECTOR index and cache them. | ||
# Phase 2: | ||
# Populate the Makefile SECTOR indexes from the cache and retrigger build | ||
# to generate final image. | ||
|
||
IMAGE_FILE="$1" | ||
TMP_SUBIMAGE="/tmp/fuzzy_subimage" | ||
shift | ||
|
||
echo "Using $IMAGE_FILE as image file" >&2 | ||
rm "${IMAGE_FILE:?}" || echo "Can't remove existing image file, continuing..." >&2 | ||
touch "${IMAGE_FILE}" | ||
function verify_subimage_and_push() { | ||
subimage_name="${1:?}" | ||
subimage="${2:?}" | ||
min_sectors="${3:?}" | ||
max_sectors="${4:?}" | ||
|
||
subImagesSectorCount=( ) | ||
for target in "$@" | ||
do | ||
echo "Appending '$target' to image" >&2 | ||
fsize=$(stat -c "%s" ${target:?}) | ||
cat ${target:?} >> ${IMAGE_FILE:?} | ||
echo "Verifying ${subimage_name:?}: ${subimage:?} min_sectors: ${min_sectors:?} max_sectors: ${max_sectors:?}" | ||
fsize=$(stat -c "%s" ${subimage:?}) | ||
|
||
if [ "$(( $fsize % 512 ))" -ne 0 ]; then | ||
echo "The intermediate image $target size isn't divisible by 512" >&2 | ||
echo "The ${subimage} size isn't divisible by 512" >&2 | ||
exit 2 | ||
fi | ||
if [ "$(( $fsize / 512 ))" -lt ${min_sectors:?} ]; then | ||
echo "The ${subimage} uses less sectors than ${min_sectors:?}" >&2 | ||
exit 2 | ||
fi | ||
subImagesSectorCount+=($(($fsize / 512)) ) | ||
done | ||
echo "${subImagesSectorCount[@]}" | ||
if [ "$(( $fsize / 512 ))" -gt ${max_sectors:?} ]; then | ||
echo "The ${subimage} uses more sectors than ${max_sectors:?}" >&2 | ||
exit 2 | ||
fi | ||
|
||
cp -f ${subimage:?} ${TMP_SUBIMAGE:?} | ||
truncate --size=%"$(( $max_sectors * 512 ))" ${TMP_SUBIMAGE:?} | ||
cat ${TMP_SUBIMAGE:?} >> ${IMAGE_FILE:?} | ||
} | ||
|
||
echo "Using $IMAGE_FILE as image file" >&2 | ||
rm "${IMAGE_FILE:?}" || echo "Can't remove existing image file, continuing..." >&2 | ||
touch "${IMAGE_FILE}" | ||
|
||
# sum of all should not exceed 256 sectors | ||
verify_subimage_and_push "bt_stage1" $1 $2 $2 | ||
verify_subimage_and_push "realmode_lib" $3 $4 $4 | ||
verify_subimage_and_push "bt_stage2" $5 $6 $6 | ||
verify_subimage_and_push "kernel" $7 $8 $8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters