initial commit

This commit is contained in:
2024-12-15 00:34:01 +06:00
commit 31efbc726f
1576 changed files with 657692 additions and 0 deletions

16
scripts/generate_build_info.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
CC="$1"
CFLAGS="$2"
cat <<EOF
#define RTL_FW_COMPILE_TIME "$(date +%Y/%m/%d-%T)"
#define RTL_FW_COMPILE_DATE "$(date +%Y%m%d)"
#define UTS_VERSION "$(date +%Y/%m/%d-%T)"
#define RTL8195AFW_COMPILE_TIME "$(date +%Y/%m/%d-%T)"
#define RTL8195AFW_COMPILE_DATE "$(date +%Y%m%d)"
#define RTL8195AFW_COMPILE_BY "$(id -u -n)"
#define RTL8195AFW_COMPILE_HOST "$(hostname)"
#define RTL8195AFW_COMPILE_DOMAIN ""
#define RTL8195AFW_COMPILER "gcc $($CC $CFLAGS -dumpversion | tr --delete '\r')"
EOF

13
scripts/patch_freertos.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
git submodule update --init
cd lib/freertos || exit 1
for patch in ../../patches/freertos/*.patch; do
if git apply "$patch"; then
echo "Applied patch: $patch"
else
echo "Failed to apply patch: $patch" >&2
exit 1
fi
done

87
scripts/process_ota.sh Executable file
View File

@@ -0,0 +1,87 @@
#!/bin/sh
set -e
while [ $# -gt 0 ]; do
case $1 in
--axf)
AXF_FILE="$2"
shift
shift
;;
--bin-dir)
BIN_DIR="$2"
shift
shift
;;
--objcopy)
OBJCOPY="$2"
shift
shift
;;
--ota-idx)
OTA_IDX="$2"
shift
shift
;;
--tools-dir)
TOOLS_DIR="$2"
shift
shift
;;
*)
echo "Unknown parameter: $1" >&2
exit 1
;;
esac
done
if [ -z "$AXF_FILE" ] || [ -z "$BIN_DIR" ] || [ -z "$OBJCOPY" ] || [ -z "$OTA_IDX" ] || [ -z "$TOOLS_DIR" ]; then
echo "Missing required parameters" >&2
exit 1
fi
# TODO: don't use the blobs
PICK="$TOOLS_DIR/pick"
CHKSUM="$TOOLS_DIR/checksum"
OTA="$TOOLS_DIR/ota"
# out files
IMAGE2_OTA="image2_all_ota${OTA_IDX}.bin"
extract_symbol() {
grep "$1" "$BIN_DIR/$(basename "$AXF_FILE" .axf).nmap" | cut -d' ' -f1
}
echo "Extracting sections..."
$OBJCOPY -j .ram_image2.entry -j .ram_image2.data -j .ram_image2.text \
-j .ram_image2.bss -j .ram_image2.skb.bss -j .ram_heap.data \
-Obinary "$AXF_FILE" "$BIN_DIR/ram_2.r.bin"
$OBJCOPY -j .xip_image2.text -Obinary "$AXF_FILE" "$BIN_DIR/xip_image2.bin"
echo "Processing memory images..."
RAM_START=$(extract_symbol __ram_image2_text_start__)
RAM_END=$(extract_symbol __ram_image2_text_end__)
XIP_START=$(extract_symbol __xip_image2_start__)
$PICK "0x$RAM_START" "0x$RAM_END" \
"$BIN_DIR/ram_2.r.bin" "$BIN_DIR/ram_2.p.bin"
$PICK "0x$XIP_START" "0x$XIP_START" \
"$BIN_DIR/xip_image2.bin" "$BIN_DIR/xip_image2.p.bin"
echo "Generating OTA image..."
cat "$BIN_DIR/xip_image2.p.bin" >"$BIN_DIR/$IMAGE2_OTA"
cat "$BIN_DIR/ram_2.p.bin" >>"$BIN_DIR/$IMAGE2_OTA"
$CHKSUM "$BIN_DIR/$IMAGE2_OTA"
# gen for 2nd ota image if needed
if [ "$OTA_IDX" = "2" ]; then
echo "Generating OTA package..."
$OTA "$BIN_DIR/image2_all_ota1.bin" 0x800B000 \
"$BIN_DIR/$IMAGE2_OTA" 0x08080000 0x20170111 \
"$BIN_DIR/ota_all.bin"
fi
echo "OTA image processing complete!"