mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Added scripts to sync rpi files for potential cross-compile.x
This commit is contained in:
parent
222fa992bb
commit
4cb35ce88f
20
script/sync-pi-sysroot.sh
Executable file
20
script/sync-pi-sysroot.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
HOST=$1
|
||||
if [[ -z $HOST ]]; then
|
||||
printf "usage: sync-pi-sysroot.sh <pi_hostname>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
|
||||
mkdir -p sysroot/usr
|
||||
mkdir -p sysroot/opt
|
||||
rsync -avz pi@$HOST:/lib sysroot
|
||||
rsync -avz pi@$HOST:/usr/include sysroot/usr
|
||||
rsync -avz pi@$HOST:/usr/lib sysroot/usr
|
||||
rsync -avz pi@$HOST:/opt/vc sysroot/opt
|
||||
|
||||
# https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
|
||||
$SCRIPT_DIR/update-pi-sysroot-symlinks.py ./sysroot
|
31
script/update-pi-sysroot-symlinks.py
Executable file
31
script/update-pi-sysroot-symlinks.py
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Take a sysroot directory and turn all the abolute symlinks and turn them into
|
||||
# relative ones such that the sysroot is usable within another system.
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage is " + sys.argv[0] + "<directory>")
|
||||
sys.exit(1)
|
||||
|
||||
topdir = sys.argv[1]
|
||||
topdir = os.path.abspath(topdir)
|
||||
|
||||
def handlelink(filep, subdir):
|
||||
link = os.readlink(filep)
|
||||
if link[0] != "/":
|
||||
return
|
||||
if link.startswith(topdir):
|
||||
return
|
||||
#print("Replacing %s with %s for %s" % (link, topdir+link, filep))
|
||||
print("Replacing %s with %s for %s" % (link, os.path.relpath(topdir+link, subdir), filep))
|
||||
os.unlink(filep)
|
||||
os.symlink(os.path.relpath(topdir+link, subdir), filep)
|
||||
|
||||
for subdir, dirs, files in os.walk(topdir):
|
||||
for f in files:
|
||||
filep = os.path.join(subdir, f)
|
||||
if os.path.islink(filep):
|
||||
#print("Considering %s" % filep)
|
||||
handlelink(filep, subdir)
|
Loading…
Reference in New Issue
Block a user