Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add renode-cli #28944

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5b1d320
Add renode-cli
MementoRC Jan 26, 2025
fca5890
(fix) remove selectors. fix typos
MementoRC Jan 27, 2025
b29216e
(fix) add tests requirements
MementoRC Jan 27, 2025
9e65189
(fix) separate arch/noarch
MementoRC Jan 28, 2025
bded9e6
(fix) update renode-cores for non-unix
MementoRC Jan 28, 2025
ab99f31
(fix) update renode-cores for non-unix
MementoRC Jan 28, 2025
c8a4e1b
(fix) use .bat for non-unix
MementoRC Jan 28, 2025
37d1d27
(wip) damn working with win is like pulling teeth
MementoRC Jan 28, 2025
3388248
(fix) use PS1
MementoRC Jan 28, 2025
e66d7d7
(ref) clean unix
MementoRC Jan 29, 2025
309d872
(fix) call 'cleaned-out' function
MementoRC Jan 29, 2025
35e9924
(fix) unix script args. permissions on non-unix
MementoRC Jan 29, 2025
4606fb7
(fix) unix typos. ppc64 not on win?
MementoRC Jan 29, 2025
51bc4e6
(wip) built non-unix till tests
MementoRC Jan 29, 2025
37927b8
(ref) clean non-unix
MementoRC Jan 29, 2025
413f1f9
(fix) tests fail?
MementoRC Jan 29, 2025
4339a60
(fix) test script: hardcode pkg_name
MementoRC Jan 30, 2025
f206438
(fix) dynamic libraries loader?
MementoRC Jan 30, 2025
cab5f38
(fix) arm64 asm code
MementoRC Jan 31, 2025
020a069
(ref) remove build.sh patch
MementoRC Jan 31, 2025
0d3e416
(dev) remove patches, switch to arch renode-cli
MementoRC Jan 31, 2025
a663b6e
(wip) solved ppc64 non-unix. Odd 'do' fail
MementoRC Jan 31, 2025
4d819f2
(wip) closing in on that wraith of an OS
MementoRC Feb 1, 2025
dc9010d
(dev) sed error?
MementoRC Feb 1, 2025
9094271
(fix) win: .so not copied to cli. arm64: clobbered
MementoRC Feb 2, 2025
b306356
(fix) win build update
MementoRC Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
(fix) unix typos. ppc64 not on win?
  • Loading branch information
MementoRC committed Jan 29, 2025
commit 4606fb7da8f8575e5fab6e6fa102a29a578d2bff
1 change: 0 additions & 1 deletion recipes/renode-cores/build.bat
Original file line number Diff line number Diff line change
@@ -18,6 +18,5 @@ set "CORES_BIN_PATH=%CORES_PATH%\bin\%CONFIGURATION%"
mkdir "%PREFIX%\Library\lib\%PKG_NAME%"
icacls "%PREFIX%\Library\lib\%PKG_NAME%" /grant Users:(OI)(CI)F /T
robocopy "%CORES_BIN_PATH%\lib" "%PREFIX%\Library\lib\%PKG_NAME%" /E /COPY:DATSO
if %errorlevel% neq 0 exit /b %errorlevel%

endlocal
12 changes: 5 additions & 7 deletions recipes/renode-cores/helpers/renode_build_with_cmake.ps1
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ $PassedArgs = $args.Where({$ValidArgs -contains $_})
$cpuCount = (Get-CimInstance Win32_Processor).NumberOfLogicalProcessors

$env:PATH = "${env:BUILD_PREFIX}/Library/mingw-w64/bin;${env:BUILD_PREFIX}/Library/bin;${env:PREFIX}/Library/bin;${env:PREFIX}/bin;${env:PATH}"
$env:ROOT_PATH = $env:SRC_DIR
$env:SRC_DIR = $env:SRC_DIR

$CMAKE = (Get-Command cmake).Source

@@ -68,12 +68,9 @@ if ($HEADLESS) {
$BUILD_TARGET = "Headless"
}

$OUT_BIN_DIR = Join-Path -Path "output\bin" -ChildPath $CONFIGURATION
$BUILD_TYPE_FILE = Join-Path -Path $OUT_BIN_DIR -ChildPath "build_type"
$CORES_PATH = Join-Path -Path $env:SRC_DIR -ChildPath "src\Infrastructure\src\Emulator\Cores"

$CORES_PATH = Join-Path -Path $env:ROOT_PATH -ChildPath "src\Infrastructure\src\Emulator\Cores"

Push-Location "$env:ROOT_PATH\tools\building"
Push-Location "$env:SRC_DIR\tools\building"
bash .\check_weak_implementations.sh
Pop-Location

@@ -94,7 +91,8 @@ function Update-CMakeLists {
}

Update-CMakeLists "$CORES_PATH\tlib\CMakeLists.txt" "-fPIC" "-Wno-unused-function"
Update-CMakeLists "$CORES_PATH\tlib\softload-3\CMakeLists.txt" "-fPIC" ""
# Not in this older 1.15.3 version (in master)
# Update-CMakeLists "$CORES_PATH\tlib\softload-3\CMakeLists.txt" "-fPIC" ""
Update-CMakeLists "$CORES_PATH\tlib\tcg\CMakeLists.txt" "-fPIC" "-Wno-unused-function"

foreach ($core_config in $CORES) {
41 changes: 7 additions & 34 deletions recipes/renode-cores/helpers/renode_build_with_cmake.sh
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@
set -u
set -e

export ROOT_PATH="$(cd $(dirname $0); echo $PWD)"

CONFIGURATION="Release"
HEADLESS=false
TLIB_ONLY=false
@@ -73,52 +71,30 @@ then
BUILD_TARGET=Headless
fi

OUT_BIN_DIR="$(get_path "output/bin/${CONFIGURATION}")"
BUILD_TYPE_FILE=$(get_path "${OUT_BIN_DIR}/build_type")

CORES_PATH="$ROOT_PATH/src/Infrastructure/src/Emulator/Cores"

# check weak implementations of core libraries
pushd "$ROOT_PATH/tools/building" > /dev/null
pushd "${SRC_DIR}/tools/building" > /dev/null
./check_weak_implementations.sh
popd > /dev/null

# Paths for tlib
CORES_PATH="${SRC_DIR}/src/Infrastructure/src/Emulator/Cores"
CORES_BUILD_PATH="$CORES_PATH/obj/$CONFIGURATION"
CORES_BIN_PATH="$CORES_PATH/bin/$CONFIGURATION"

CMAKE_GEN="-GUnix Makefiles"

# Macos architecture flags, to make rosetta work properly
if $ON_OSX
then
if [[ "${target_platform}" == "osx-64" ]]; then
CMAKE_COMMON+=" -DCMAKE_OSX_ARCHITECTURES=x86_64"
if [ $HOST_ARCH == "aarch64" ]; then
CMAKE_COMMON+=" -DCMAKE_OSX_ARCHITECTURES=arm64"
fi
fi
if [[ "${target_platform}" == "osx-arm64" ]]; then
CMAKE_COMMON+=" -DCMAKE_OSX_ARCHITECTURES=arm64"
fi

# This list contains all cores that will be built.
# If you are adding a new core or endianness add it here to have the correct tlib built
CORES=(arm.le arm.be arm64.le arm-m.le arm-m.be ppc.le ppc.be ppc64.le ppc64.be i386.le x86_64.le riscv.le riscv64.le sparc.le sparc.be xtensa.le)

# if '--tlib-arch' was used - pick the first matching one
if [[ ! -z $TLIB_ARCH ]]; then
NONE_MATCHED=true
for potential_match in "${CORES[@]}"; do
if [[ $potential_match == "$TLIB_ARCH"* ]]; then
CORES=($potential_match)
echo "Compiling tlib for $potential_match"
NONE_MATCHED=false
break
fi
done
if $NONE_MATCHED ; then
echo "Failed to match any tlib arch"
exit 1
fi
fi

# build tlib
for core_config in "${CORES[@]}"
do
@@ -138,16 +114,13 @@ do
if [[ $ENDIAN == "be" ]]; then
CMAKE_CONF_FLAGS+=" -DTARGET_BIG_ENDIAN=1"
fi
if [[ "$TLIB_EXPORT_COMPILE_COMMANDS" = true ]]; then
CMAKE_CONF_FLAGS+=" -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
fi

cmake "$CMAKE_GEN" $CMAKE_COMMON $CMAKE_CONF_FLAGS -DHOST_ARCH=$HOST_ARCH $CORES_PATH
cmake --build .

CORE_BIN_DIR=$CORES_BIN_PATH/lib
mkdir -p $CORE_BIN_DIR
if $ON_OSX; then
if [[ "${target_platform}" == "osx-"* ]]; then
# macos `cp` does not have the -u flag
cp -v tlib/*.so $CORE_BIN_DIR/
else
35 changes: 18 additions & 17 deletions recipes/renode-cores/recipe.yaml
Original file line number Diff line number Diff line change
@@ -40,23 +40,24 @@ requirements:
tests:
- package_contents:
files:
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-xtensa-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-arm-be.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-arm-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-arm-m-be.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-arm-m-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-arm64-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-i386-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-ppc-be.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-ppc-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-ppc64-be.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-ppc64-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-riscv-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-riscv64-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-sparc-be.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-sparc-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-x86_64-le.so
- ${{ "LIBRARY/" if not unix }}lib/renode-cores/translate-xtensa-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-arm-be.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-arm-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-arm-m-be.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-arm-m-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-arm64-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-i386-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-ppc-be.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-ppc-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-riscv-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-riscv64-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-sparc-be.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-sparc-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-x86_64-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-xtensa-le.so
- if: unix
then:
- ${{ "Library/" if not unix }}lib/renode-cores/translate-ppc64-be.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-ppc64-le.so

about:
homepage: https://github.com/renode/renode
Loading