1 Star 0 Fork 23

pangzhifeng/open_ipc

forked from endless/open_ipc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.sh 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
endless 提交于 2024-11-20 10:47 . 更新
#!/bin/bash
set -e
BASE_PATH=$(dirname $(readlink -f $0))
BUILD_PATH="$BASE_PATH/build"
function usage() {
echo "usage: ./build.sh [command] [platform] [mode]"
echo "example: ./build.sh build m64x86 debug"
echo "commands:"
echo " build - Build the project"
echo " test - Build and run tests"
echo " copy - Copy files to QEMU image"
echo " run - Run QEMU emulator"
echo " monitor - Enter QEMU monitor mode"
echo " plug - Plug USB device into QEMU"
echo " unplug - Unplug USB device from QEMU"
echo " quit - Quit QEMU emulator"
echo ""
echo "platform: m64x86, aarch64, 3516cv610 (default: aarch64)"
echo "mode: debug, release, test (default: release)"
}
function build_platform() {
PLATFORM=$1
MODE=${2:-debug}
TEST=${3:-OFF}
rm -rf "$BUILD_PATH/$PLATFORM"
rm -rf "$BASE_PATH/package/bin/web"
mkdir -pv "$BUILD_PATH/$PLATFORM"
cd "$BUILD_PATH"/"$PLATFORM"
cmake $BASE_PATH -B$BUILD_PATH/$PLATFORM -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$MODE -DBUILD_TESTS=$TEST
make -j8
}
function main() {
COMMAND=$1
PLATFORM=${2:-aarch64} # 使用$2获取平台参数
MODE=${3:-release} # 使用$3获取模式参数
case $COMMAND in
build)
build_platform "$PLATFORM" "$MODE" "OFF"
;;
test)
build_platform "$PLATFORM" "$MODE" "ON"
;;
copy)
source qemu/qemu.sh
copy_to_image "$PLATFORM"
;;
run)
source qemu/qemu.sh
run_qemu "$PLATFORM"
;;
monitor)
source qemu/qemu.sh
run_qemu_monitor
;;
plug)
source qemu/qemu.sh
plug_usb
;;
unplug)
source qemu/qemu.sh
unplug_usb
;;
quit)
source qemu/qemu.sh
quit_qemu
;;
*)
usage
exit 1
;;
esac
}
main "$@"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/hangzhou_zhinuo_co_ltd_pangzhifeng/open_ipc.git
[email protected]:hangzhou_zhinuo_co_ltd_pangzhifeng/open_ipc.git
hangzhou_zhinuo_co_ltd_pangzhifeng
open_ipc
open_ipc
master

搜索帮助