2020-07-08 13:11:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2022-12-13 16:24:47 +00:00
|
|
|
ARCH=$1
|
|
|
|
LINK_ARCH=$ARCH
|
|
|
|
|
|
|
|
case "$ARCH" in
|
|
|
|
arm)
|
|
|
|
TIZEN_ARCH="armv7hl"
|
|
|
|
;;
|
|
|
|
armel)
|
|
|
|
TIZEN_ARCH="armv7l"
|
|
|
|
LINK_ARCH="arm"
|
|
|
|
;;
|
|
|
|
arm64)
|
|
|
|
TIZEN_ARCH="aarch64"
|
|
|
|
;;
|
|
|
|
x86)
|
|
|
|
TIZEN_ARCH="i686"
|
|
|
|
;;
|
|
|
|
x64)
|
|
|
|
TIZEN_ARCH="x86_64"
|
|
|
|
LINK_ARCH="x86"
|
|
|
|
;;
|
2023-10-19 20:12:15 +00:00
|
|
|
riscv64)
|
|
|
|
TIZEN_ARCH="riscv64"
|
|
|
|
LINK_ARCH="riscv"
|
|
|
|
;;
|
2022-12-13 16:24:47 +00:00
|
|
|
*)
|
|
|
|
echo "Unsupported architecture for tizen: $ARCH"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2020-07-08 13:11:11 +00:00
|
|
|
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
2022-12-13 16:24:47 +00:00
|
|
|
__TIZEN_CROSSDIR="$__CrossDir/${ARCH}/tizen"
|
2020-07-08 13:11:11 +00:00
|
|
|
|
|
|
|
if [[ -z "$ROOTFS_DIR" ]]; then
|
|
|
|
echo "ROOTFS_DIR is not defined."
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
|
|
|
|
mkdir -p $TIZEN_TMP_DIR
|
|
|
|
|
|
|
|
# Download files
|
|
|
|
echo ">>Start downloading files"
|
2022-12-13 16:24:47 +00:00
|
|
|
VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH
|
2020-07-08 13:11:11 +00:00
|
|
|
echo "<<Finish downloading files"
|
|
|
|
|
|
|
|
echo ">>Start constructing Tizen rootfs"
|
|
|
|
TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
|
|
|
|
cd $ROOTFS_DIR
|
|
|
|
for f in $TIZEN_RPM_FILES; do
|
|
|
|
rpm2cpio $f | cpio -idm --quiet
|
|
|
|
done
|
|
|
|
echo "<<Finish constructing Tizen rootfs"
|
|
|
|
|
|
|
|
# Cleanup tmp
|
|
|
|
rm -rf $TIZEN_TMP_DIR
|
|
|
|
|
|
|
|
# Configure Tizen rootfs
|
|
|
|
echo ">>Start configuring Tizen rootfs"
|
2022-12-13 16:24:47 +00:00
|
|
|
ln -sfn asm-${LINK_ARCH} ./usr/include/asm
|
2020-07-08 13:11:11 +00:00
|
|
|
patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
|
2023-10-19 20:12:15 +00:00
|
|
|
if [[ "$TIZEN_ARCH" == "riscv64" ]]; then
|
|
|
|
echo "Fixing broken symlinks in $PWD"
|
|
|
|
rm ./usr/lib64/libresolv.so
|
|
|
|
ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so
|
|
|
|
rm ./usr/lib64/libpthread.so
|
|
|
|
ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so
|
|
|
|
rm ./usr/lib64/libdl.so
|
|
|
|
ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so
|
|
|
|
rm ./usr/lib64/libutil.so
|
|
|
|
ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so
|
|
|
|
rm ./usr/lib64/libm.so
|
|
|
|
ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so
|
|
|
|
rm ./usr/lib64/librt.so
|
|
|
|
ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so
|
|
|
|
rm ./lib/ld-linux-riscv64-lp64d.so.1
|
|
|
|
ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1
|
|
|
|
fi
|
2020-07-08 13:11:11 +00:00
|
|
|
echo "<<Finish configuring Tizen rootfs"
|