30 lines
718 B
Bash
30 lines
718 B
Bash
#!/bin/bash
|
|
|
|
generate_offset_header() {
|
|
echo "processing $1"
|
|
nm -n "$1" \
|
|
| grep -e ' _\(end\|edata\|data\)$' \
|
|
| awk '{print "#define CAP_" $3 " 0x" $1}' \
|
|
> arch/x86/boot/offset.h
|
|
nm -n "$1" \
|
|
| grep -e ' efi_pe_entry$' \
|
|
| awk '{print "#define efi_pe_entry 0x" $1}' \
|
|
>> arch/x86/boot/offset.h
|
|
}
|
|
build_image() {
|
|
echo "building image from $1 and $2"
|
|
(dd if=$1 bs=4k conv=sync; cat $2) > yukiImage
|
|
}
|
|
# Main dispatcher
|
|
case "$1" in
|
|
generate_offset_header)
|
|
generate_offset_header "$2"
|
|
;;
|
|
build_image)
|
|
build_image "$2" "$3"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {generate_offset_header|build_image} [args...]"
|
|
exit 1
|
|
;;
|
|
esac |