From a5a395cce2d24928b11735f315c231dd104acd71 Mon Sep 17 00:00:00 2001 From: Thomas Van Iseghem Date: Tue, 23 May 2023 18:04:55 +0200 Subject: Created a better slimmed down emulation container --- CorOS-dev-environment/.gitignore | 7 ++ CorOS-dev-environment/CorOS-emulation/Dockerfile | 22 ++++++ .../CorOS-emulation/docker-compose.yaml | 21 ++++++ CorOS-dev-environment/README.md | 77 +++++++++++++++++++++ CorOS-dev-environment/filesystems/README.md | 7 ++ CorOS-dev-environment/init_system.sh | 41 +++++++++++ CorOS-dev-environment/install_qt_compiled.sh | 8 +++ CorOS-dev-environment/install_qt_src.sh | 4 ++ CorOS-dev-environment/install_toolchain(broken).sh | 37 ++++++++++ CorOS-dev-environment/install_toolchain.sh | 6 ++ CorOS-dev-environment/qt-compiled-4.8.7.tar.gz | Bin 0 -> 29628859 bytes CorOS-dev-environment/update-builder.sh | 23 ++++++ QC-dev-environment/.gitignore | 7 -- QC-dev-environment/README.md | 77 --------------------- QC-dev-environment/filesystems/README.md | 7 -- QC-dev-environment/init_system.sh | 41 ----------- QC-dev-environment/install_qt_compiled.sh | 8 --- QC-dev-environment/install_qt_src.sh | 4 -- QC-dev-environment/install_toolchain(broken).sh | 37 ---------- QC-dev-environment/install_toolchain.sh | 6 -- QC-dev-environment/qt-compiled-4.8.7.tar.gz | 3 - QC-dev-environment/update-builder.sh | 23 ------ 22 files changed, 253 insertions(+), 213 deletions(-) create mode 100644 CorOS-dev-environment/.gitignore create mode 100644 CorOS-dev-environment/CorOS-emulation/Dockerfile create mode 100644 CorOS-dev-environment/CorOS-emulation/docker-compose.yaml create mode 100644 CorOS-dev-environment/README.md create mode 100644 CorOS-dev-environment/filesystems/README.md create mode 100644 CorOS-dev-environment/init_system.sh create mode 100644 CorOS-dev-environment/install_qt_compiled.sh create mode 100644 CorOS-dev-environment/install_qt_src.sh create mode 100644 CorOS-dev-environment/install_toolchain(broken).sh create mode 100644 CorOS-dev-environment/install_toolchain.sh create mode 100644 CorOS-dev-environment/qt-compiled-4.8.7.tar.gz create mode 100644 CorOS-dev-environment/update-builder.sh delete mode 100644 QC-dev-environment/.gitignore delete mode 100644 QC-dev-environment/README.md delete mode 100644 QC-dev-environment/filesystems/README.md delete mode 100644 QC-dev-environment/init_system.sh delete mode 100644 QC-dev-environment/install_qt_compiled.sh delete mode 100644 QC-dev-environment/install_qt_src.sh delete mode 100644 QC-dev-environment/install_toolchain(broken).sh delete mode 100644 QC-dev-environment/install_toolchain.sh delete mode 100644 QC-dev-environment/qt-compiled-4.8.7.tar.gz delete mode 100644 QC-dev-environment/update-builder.sh diff --git a/CorOS-dev-environment/.gitignore b/CorOS-dev-environment/.gitignore new file mode 100644 index 0000000..b631c5c --- /dev/null +++ b/CorOS-dev-environment/.gitignore @@ -0,0 +1,7 @@ +# ignore everything in the mount folder except the filesystems folder +# and the mount folder itself + +/mount/* +/filesystems/* +!/mount +!/filesystems/README.md diff --git a/CorOS-dev-environment/CorOS-emulation/Dockerfile b/CorOS-dev-environment/CorOS-emulation/Dockerfile new file mode 100644 index 0000000..1f24b79 --- /dev/null +++ b/CorOS-dev-environment/CorOS-emulation/Dockerfile @@ -0,0 +1,22 @@ +# Slim Debian image with QEMU and dos2unix +FROM debian:buster-slim + +# Add required packages in the noninteractive mode +RUN apt-get -y update && apt-get -y -q install dos2unix qemu qemu-user-static + +# # Set toolchain PATH for remote container +RUN mkdir -p /opt/ARM/sysroot +ENV QEMU_LD_PREFIX="/opt/ARM/sysroot" + +# Mounting the QC-rootfs +RUN mkdir qc-fs qc-fs-uncompressed qt_src + +WORKDIR /qt_src +# # Copy and run the installer +COPY qt-compiled-4.8.7.tar.gz install_qt_compiled.sh . + +WORKDIR / +COPY init_system.sh update-builder.sh . +RUN dos2unix init_system.sh update-builder.sh /qt_src/install_qt_compiled.sh + +ENTRYPOINT ["/bin/bash"] diff --git a/CorOS-dev-environment/CorOS-emulation/docker-compose.yaml b/CorOS-dev-environment/CorOS-emulation/docker-compose.yaml new file mode 100644 index 0000000..f83534c --- /dev/null +++ b/CorOS-dev-environment/CorOS-emulation/docker-compose.yaml @@ -0,0 +1,21 @@ +# Docker compose file for easy volume mounting and running of the container + +services: + coros-emu: + image: opencortex/coros-emu:latest + build: + context: ../ + dockerfile: CorOS-emulation/Dockerfile + tags: + - opencortex/coros-emu:latest + + volumes: + - ../filesystems:/qc-fs + - ../mount:/mnt + + environment: + # Edit this to your needs. This should be just the file name, not the path. + - UPDATE_FILE=verify.bin.gz + + privileged: true + entrypoint: /bin/bash -c "while true; do sleep 1; done" \ No newline at end of file diff --git a/CorOS-dev-environment/README.md b/CorOS-dev-environment/README.md new file mode 100644 index 0000000..b236306 --- /dev/null +++ b/CorOS-dev-environment/README.md @@ -0,0 +1,77 @@ +# A safe development environment + +## Usage + +### Building the container + +Go into the QC-dev-environment directory and run: + +``` +docker build . -t +``` + +### Getting the update file + +The update process of the QC is done in 2 steps. First the download, after that the install. We can use this to our advantage to grab the actual update file. Once you downloaded the update **do not install it yet.** Get an SSH shell going and go to `/media/p4`. There you will find your update file. A registry of these file names is also available inside the `filesystems/README.md` of this folder. + +You can use the `scp` tool to send this update file over to your system. + +Once you've got the update file, you can put it inside the `filesystems` directory to mount to the docker container. Now you can use the update file to explore your QC (except for the user files), and even create custom update packages. + +### Running the container + +It needs to run privileged since we need to run the `mount` command inside it. You can run it without the `--privileged` path if you're not planning to mount the QC's file system and just want to compile something. + +The `mount` folder is optional. But it's an easy way to get files from to host inside the container and vice versa. + +``` +docker run --privileged -it -p 5900:5900 \ + -v /mount:/mnt \ + -v /filesystems:/qc-fs \ + -e UPDATE_FILE= \ + cortex-dev +``` + +Another way is to use `docker compose`. In the `docker-compose.yaml` file, all volumes are already defined. This means you only have to define the update file in the `environment` section. + +To use this first run the service in detached mode + +``` +docker compose up -d +``` + +After that you can attach to the container using + +``` +docker compose exec cortex-dev /bin/bash +``` + +When attached to the docker container's shell, there is one post-install step left. Run the following command: + +``` +./init_system.sh +``` + +This will mount the QC filesystem and install a custom compiled version of QT inside it that has support for VNC. + +To link QT to the right fonts folder, run: + +```bash +export QT_QWS_FONTDIR=/etc/fonts +``` + +## Creating an update package + +You can create a custom update package based on the mounted filesystem, by running the `update-builder.sh` script. This can be found in the root of the docker container. This way you can patch your update to include all mods and ssh access, without opening the QC up everytime. + +The update file should be available on your host machine at `filesystems/update-opencortex.bin.gz`. You can validate the update file by mounting it as the actual update file using the `UPDATE_FILE` environment variable and running `init_system.sh`. + + +## Config for custom compiled QT + +For running GUI applications such as `ZenUI` it is possible to output the video to a virtual device. One of these posibilities is a simple VNC server. To enable this ability I have compiled QT from source using the following config: + +``` +./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -nomake examples -nomake demos -opensource -qt-libtiff -qt-zlib -qt-libpng -qt-libmng -qt-libjpeg -optimized-qmake -qt-freetype -qt-gfx-vnc -no-webkit -no-javascript-jit -optimized-qmake -no-cups && make +``` + diff --git a/CorOS-dev-environment/filesystems/README.md b/CorOS-dev-environment/filesystems/README.md new file mode 100644 index 0000000..fc4da30 --- /dev/null +++ b/CorOS-dev-environment/filesystems/README.md @@ -0,0 +1,7 @@ +# Update name registry + +Update download files are found inside `/media/p4/update-.bin` + +**2.0.0:** update-vm44GCkrMujYR8o47OkF8UW.AdVYyu0U + +**2.0.1:** update-cIR97IrfvF4fKfO5_KIm_j_aP2zGiHp_ \ No newline at end of file diff --git a/CorOS-dev-environment/init_system.sh b/CorOS-dev-environment/init_system.sh new file mode 100644 index 0000000..8b931f9 --- /dev/null +++ b/CorOS-dev-environment/init_system.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Decompress archive and mount rootfs.ext3 +gunzip -d -k /qc-fs/$UPDATE_FILE +# Run tar command on the decompressed file to extract the rootfs.ext3 file +# We need to remove the .gz extension from the file name +tar -xvf /qc-fs/${UPDATE_FILE::-3} -C /qc-fs-uncompressed +rm /qc-fs/${UPDATE_FILE::-3} + +echo "Mounting rootfs.ext3" +mount -t ext4 /qc-fs-uncompressed/rootfs.ext3 $QEMU_LD_PREFIX +echo "Mounting rootfs.ext3 finished" + +# Promt the user to install custom QT +# if the user types "y" or "Y" then install custom QT +echo "Do you want to install the custom compiled QT? (y/n)" +echo "" +read -n 1 -r +echo "" + +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo "Installing QT" + cd /qt_src && ./install_qt_compiled.sh + echo "Installing QT finished" +fi + +# Prompt user to chroot into the $QEMU_LD_PREFIX directory +# if the user types "y" or "Y" then chroot into the $QEMU_LD_PREFIX directory +# otherwise exit the script +echo "Do you want to chroot into the created QC-filesystem? (y/n)" +echo "" +read -n 1 -r +echo "" + +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo "" + echo "Chrooting into $QEMU_LD_PREFIX" + chroot $QEMU_LD_PREFIX +fi diff --git a/CorOS-dev-environment/install_qt_compiled.sh b/CorOS-dev-environment/install_qt_compiled.sh new file mode 100644 index 0000000..2094de0 --- /dev/null +++ b/CorOS-dev-environment/install_qt_compiled.sh @@ -0,0 +1,8 @@ +#!/bin/bash +tar -xf qt-compiled-4.8.7.tar.gz +rm qt-compiled-4.8.7.tar.gz +# Then install it +cp -a QtEmbedded-4.8.7-arm/lib/. $QEMU_LD_PREFIX/usr/lib/ +cp -a QtEmbedded-4.8.7-arm/bin/. $QEMU_LD_PREFIX/usr/bin/ + +QT_QWS_FONTDIR=/etc/fonts \ No newline at end of file diff --git a/CorOS-dev-environment/install_qt_src.sh b/CorOS-dev-environment/install_qt_src.sh new file mode 100644 index 0000000..66a381b --- /dev/null +++ b/CorOS-dev-environment/install_qt_src.sh @@ -0,0 +1,4 @@ +# First download the package using wget +wget -LO https://src.fedoraproject.org/repo/pkgs/qt/qt-everywhere-opensource-src-4.8.7.tar.gz/d990ee66bf7ab0c785589776f35ba6ad/qt-everywhere-opensource-src-4.8.7.tar.gz +# Then extract it +tar -zxvf qt-everywhere-opensource-src-4.8.7.tar.gz diff --git a/CorOS-dev-environment/install_toolchain(broken).sh b/CorOS-dev-environment/install_toolchain(broken).sh new file mode 100644 index 0000000..c3b05fa --- /dev/null +++ b/CorOS-dev-environment/install_toolchain(broken).sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Currently the latest addin .deb package is corrupted. It is unable to be unpacked. +# This script is used to download the latest addin .deb package and install it. + +##################################### Install Toolchain ############################# +linux_addin_version=$1 + +linux_addin_link="https://download.analog.com/tools/LinuxAddInForCCES/Releases/Release_$linux_addin_version/adi-LinuxAddinForCCES-linux-x86-$linux_addin_version.deb" + +echo "Start downloading linux-addin ($linux_addin_link)" +wget --quiet $linux_addin_link +echo "linux-addin download finished" +linux_addin_link=`basename $linux_addin_link` +linux_addin_name=`basename $linux_addin_link` + + +linux_addin_deb=$linux_addin_link +echo "Start to install $linux_addin_name, Installing..." +export DEBIAN_FRONTEND=noninteractive +ls +echo "dpkg -i $linux_addin_deb" +dpkg -i $linux_addin_deb +echo "Finished, $linux_addin_name installed into PATH=/opt/analog/cces-linux-add-in/${linux_addin_vesion}/ARM/arm-none-eabi/bin/" +########################################################################################## + +##################### Get source codes(u-boot & buildroot) form linu-add-in ############ +echo "Start to unzip the source-code to workspace, Installing..." +source_code_path=$2 +tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/buildroot-sc5xx-${linux_addin_version}/src/buildroot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path} +tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/uboot-sc5xx-${linux_addin_version}/src/uboot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path} +echo "Finished, source-code{uboot & buildroot} in the PATH=${source_code_path}" + +#Apply the patch for automake of buildroot +echo "Apply the patch for automake of buildroot" +patch=$3 +cp ${patch} ${source_code_path}/buildroot/package/automake/ +########################################################################################## \ No newline at end of file diff --git a/CorOS-dev-environment/install_toolchain.sh b/CorOS-dev-environment/install_toolchain.sh new file mode 100644 index 0000000..d4a5465 --- /dev/null +++ b/CorOS-dev-environment/install_toolchain.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Original toolchain download is broken, debian package can't be unpacked. +# This is the /opt/analog folder from the debian package. +curl -LO https://www.roelj.com/qc/qc-compiler-toolchain.tar.gz +cd / +tar axvf $1/qc-compiler-toolchain.tar.gz \ No newline at end of file diff --git a/CorOS-dev-environment/qt-compiled-4.8.7.tar.gz b/CorOS-dev-environment/qt-compiled-4.8.7.tar.gz new file mode 100644 index 0000000..8b8658c Binary files /dev/null and b/CorOS-dev-environment/qt-compiled-4.8.7.tar.gz differ diff --git a/CorOS-dev-environment/update-builder.sh b/CorOS-dev-environment/update-builder.sh new file mode 100644 index 0000000..ab4e8b9 --- /dev/null +++ b/CorOS-dev-environment/update-builder.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# This script can be used to apply OpenCortex patches to a mounted QC file system +# And create a new update file from it + +# This script is intended to be run from the QC-dev-environment directory +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +echo "${BLUE}========= OpenCortex Update Builder =========${NC}" + +cd /qc-fs-uncompressed + +echo "" +echo "${BLUE}[+]${NC} Building update file..." +echo "" +tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb +echo "" +echo "This can take some seconds, please wait..." +gzip -k update-opencortex.bin +cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz +echo "" +echo "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" \ No newline at end of file diff --git a/QC-dev-environment/.gitignore b/QC-dev-environment/.gitignore deleted file mode 100644 index b631c5c..0000000 --- a/QC-dev-environment/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# ignore everything in the mount folder except the filesystems folder -# and the mount folder itself - -/mount/* -/filesystems/* -!/mount -!/filesystems/README.md diff --git a/QC-dev-environment/README.md b/QC-dev-environment/README.md deleted file mode 100644 index b236306..0000000 --- a/QC-dev-environment/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# A safe development environment - -## Usage - -### Building the container - -Go into the QC-dev-environment directory and run: - -``` -docker build . -t -``` - -### Getting the update file - -The update process of the QC is done in 2 steps. First the download, after that the install. We can use this to our advantage to grab the actual update file. Once you downloaded the update **do not install it yet.** Get an SSH shell going and go to `/media/p4`. There you will find your update file. A registry of these file names is also available inside the `filesystems/README.md` of this folder. - -You can use the `scp` tool to send this update file over to your system. - -Once you've got the update file, you can put it inside the `filesystems` directory to mount to the docker container. Now you can use the update file to explore your QC (except for the user files), and even create custom update packages. - -### Running the container - -It needs to run privileged since we need to run the `mount` command inside it. You can run it without the `--privileged` path if you're not planning to mount the QC's file system and just want to compile something. - -The `mount` folder is optional. But it's an easy way to get files from to host inside the container and vice versa. - -``` -docker run --privileged -it -p 5900:5900 \ - -v /mount:/mnt \ - -v /filesystems:/qc-fs \ - -e UPDATE_FILE= \ - cortex-dev -``` - -Another way is to use `docker compose`. In the `docker-compose.yaml` file, all volumes are already defined. This means you only have to define the update file in the `environment` section. - -To use this first run the service in detached mode - -``` -docker compose up -d -``` - -After that you can attach to the container using - -``` -docker compose exec cortex-dev /bin/bash -``` - -When attached to the docker container's shell, there is one post-install step left. Run the following command: - -``` -./init_system.sh -``` - -This will mount the QC filesystem and install a custom compiled version of QT inside it that has support for VNC. - -To link QT to the right fonts folder, run: - -```bash -export QT_QWS_FONTDIR=/etc/fonts -``` - -## Creating an update package - -You can create a custom update package based on the mounted filesystem, by running the `update-builder.sh` script. This can be found in the root of the docker container. This way you can patch your update to include all mods and ssh access, without opening the QC up everytime. - -The update file should be available on your host machine at `filesystems/update-opencortex.bin.gz`. You can validate the update file by mounting it as the actual update file using the `UPDATE_FILE` environment variable and running `init_system.sh`. - - -## Config for custom compiled QT - -For running GUI applications such as `ZenUI` it is possible to output the video to a virtual device. One of these posibilities is a simple VNC server. To enable this ability I have compiled QT from source using the following config: - -``` -./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -nomake examples -nomake demos -opensource -qt-libtiff -qt-zlib -qt-libpng -qt-libmng -qt-libjpeg -optimized-qmake -qt-freetype -qt-gfx-vnc -no-webkit -no-javascript-jit -optimized-qmake -no-cups && make -``` - diff --git a/QC-dev-environment/filesystems/README.md b/QC-dev-environment/filesystems/README.md deleted file mode 100644 index fc4da30..0000000 --- a/QC-dev-environment/filesystems/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Update name registry - -Update download files are found inside `/media/p4/update-.bin` - -**2.0.0:** update-vm44GCkrMujYR8o47OkF8UW.AdVYyu0U - -**2.0.1:** update-cIR97IrfvF4fKfO5_KIm_j_aP2zGiHp_ \ No newline at end of file diff --git a/QC-dev-environment/init_system.sh b/QC-dev-environment/init_system.sh deleted file mode 100644 index 8b931f9..0000000 --- a/QC-dev-environment/init_system.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# Decompress archive and mount rootfs.ext3 -gunzip -d -k /qc-fs/$UPDATE_FILE -# Run tar command on the decompressed file to extract the rootfs.ext3 file -# We need to remove the .gz extension from the file name -tar -xvf /qc-fs/${UPDATE_FILE::-3} -C /qc-fs-uncompressed -rm /qc-fs/${UPDATE_FILE::-3} - -echo "Mounting rootfs.ext3" -mount -t ext4 /qc-fs-uncompressed/rootfs.ext3 $QEMU_LD_PREFIX -echo "Mounting rootfs.ext3 finished" - -# Promt the user to install custom QT -# if the user types "y" or "Y" then install custom QT -echo "Do you want to install the custom compiled QT? (y/n)" -echo "" -read -n 1 -r -echo "" - -if [[ $REPLY =~ ^[Yy]$ ]] -then - echo "Installing QT" - cd /qt_src && ./install_qt_compiled.sh - echo "Installing QT finished" -fi - -# Prompt user to chroot into the $QEMU_LD_PREFIX directory -# if the user types "y" or "Y" then chroot into the $QEMU_LD_PREFIX directory -# otherwise exit the script -echo "Do you want to chroot into the created QC-filesystem? (y/n)" -echo "" -read -n 1 -r -echo "" - -if [[ $REPLY =~ ^[Yy]$ ]] -then - echo "" - echo "Chrooting into $QEMU_LD_PREFIX" - chroot $QEMU_LD_PREFIX -fi diff --git a/QC-dev-environment/install_qt_compiled.sh b/QC-dev-environment/install_qt_compiled.sh deleted file mode 100644 index 2094de0..0000000 --- a/QC-dev-environment/install_qt_compiled.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -tar -xf qt-compiled-4.8.7.tar.gz -rm qt-compiled-4.8.7.tar.gz -# Then install it -cp -a QtEmbedded-4.8.7-arm/lib/. $QEMU_LD_PREFIX/usr/lib/ -cp -a QtEmbedded-4.8.7-arm/bin/. $QEMU_LD_PREFIX/usr/bin/ - -QT_QWS_FONTDIR=/etc/fonts \ No newline at end of file diff --git a/QC-dev-environment/install_qt_src.sh b/QC-dev-environment/install_qt_src.sh deleted file mode 100644 index 66a381b..0000000 --- a/QC-dev-environment/install_qt_src.sh +++ /dev/null @@ -1,4 +0,0 @@ -# First download the package using wget -wget -LO https://src.fedoraproject.org/repo/pkgs/qt/qt-everywhere-opensource-src-4.8.7.tar.gz/d990ee66bf7ab0c785589776f35ba6ad/qt-everywhere-opensource-src-4.8.7.tar.gz -# Then extract it -tar -zxvf qt-everywhere-opensource-src-4.8.7.tar.gz diff --git a/QC-dev-environment/install_toolchain(broken).sh b/QC-dev-environment/install_toolchain(broken).sh deleted file mode 100644 index c3b05fa..0000000 --- a/QC-dev-environment/install_toolchain(broken).sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Currently the latest addin .deb package is corrupted. It is unable to be unpacked. -# This script is used to download the latest addin .deb package and install it. - -##################################### Install Toolchain ############################# -linux_addin_version=$1 - -linux_addin_link="https://download.analog.com/tools/LinuxAddInForCCES/Releases/Release_$linux_addin_version/adi-LinuxAddinForCCES-linux-x86-$linux_addin_version.deb" - -echo "Start downloading linux-addin ($linux_addin_link)" -wget --quiet $linux_addin_link -echo "linux-addin download finished" -linux_addin_link=`basename $linux_addin_link` -linux_addin_name=`basename $linux_addin_link` - - -linux_addin_deb=$linux_addin_link -echo "Start to install $linux_addin_name, Installing..." -export DEBIAN_FRONTEND=noninteractive -ls -echo "dpkg -i $linux_addin_deb" -dpkg -i $linux_addin_deb -echo "Finished, $linux_addin_name installed into PATH=/opt/analog/cces-linux-add-in/${linux_addin_vesion}/ARM/arm-none-eabi/bin/" -########################################################################################## - -##################### Get source codes(u-boot & buildroot) form linu-add-in ############ -echo "Start to unzip the source-code to workspace, Installing..." -source_code_path=$2 -tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/buildroot-sc5xx-${linux_addin_version}/src/buildroot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path} -tar -zxvf /opt/analog/cces-linux-add-in/${linux_addin_version}/uboot-sc5xx-${linux_addin_version}/src/uboot-sc5xx-${linux_addin_version}.tar.gz -C ${source_code_path} -echo "Finished, source-code{uboot & buildroot} in the PATH=${source_code_path}" - -#Apply the patch for automake of buildroot -echo "Apply the patch for automake of buildroot" -patch=$3 -cp ${patch} ${source_code_path}/buildroot/package/automake/ -########################################################################################## \ No newline at end of file diff --git a/QC-dev-environment/install_toolchain.sh b/QC-dev-environment/install_toolchain.sh deleted file mode 100644 index d4a5465..0000000 --- a/QC-dev-environment/install_toolchain.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# Original toolchain download is broken, debian package can't be unpacked. -# This is the /opt/analog folder from the debian package. -curl -LO https://www.roelj.com/qc/qc-compiler-toolchain.tar.gz -cd / -tar axvf $1/qc-compiler-toolchain.tar.gz \ No newline at end of file diff --git a/QC-dev-environment/qt-compiled-4.8.7.tar.gz b/QC-dev-environment/qt-compiled-4.8.7.tar.gz deleted file mode 100644 index b6c5d9e..0000000 --- a/QC-dev-environment/qt-compiled-4.8.7.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fe15ddfe0556182666237ec6cc767eef3216d59f51529b9d7a62654a4d07dbee -size 29628859 diff --git a/QC-dev-environment/update-builder.sh b/QC-dev-environment/update-builder.sh deleted file mode 100644 index ab4e8b9..0000000 --- a/QC-dev-environment/update-builder.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# This script can be used to apply OpenCortex patches to a mounted QC file system -# And create a new update file from it - -# This script is intended to be run from the QC-dev-environment directory -BLUE='\033[0;34m' -NC='\033[0m' # No Color - -echo "${BLUE}========= OpenCortex Update Builder =========${NC}" - -cd /qc-fs-uncompressed - -echo "" -echo "${BLUE}[+]${NC} Building update file..." -echo "" -tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb -echo "" -echo "This can take some seconds, please wait..." -gzip -k update-opencortex.bin -cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz -echo "" -echo "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" \ No newline at end of file -- cgit v1.2.3 From e547abab28f16fd33c23f935e045b650c871747b Mon Sep 17 00:00:00 2001 From: Thomas Van Iseghem Date: Tue, 23 May 2023 19:16:37 +0200 Subject: Updated the large development environment --- CorOS-dev-environment/CorOS-build-env/Dockerfile | 31 +++++++++++++++ .../CorOS-build-env/docker-compose.yaml | 21 ++++++++++ QC-dev-environment/Dockerfile | 46 ---------------------- QC-dev-environment/docker-compose.yaml | 21 ---------- 4 files changed, 52 insertions(+), 67 deletions(-) create mode 100644 CorOS-dev-environment/CorOS-build-env/Dockerfile create mode 100644 CorOS-dev-environment/CorOS-build-env/docker-compose.yaml delete mode 100644 QC-dev-environment/Dockerfile delete mode 100644 QC-dev-environment/docker-compose.yaml diff --git a/CorOS-dev-environment/CorOS-build-env/Dockerfile b/CorOS-dev-environment/CorOS-build-env/Dockerfile new file mode 100644 index 0000000..9ddd439 --- /dev/null +++ b/CorOS-dev-environment/CorOS-build-env/Dockerfile @@ -0,0 +1,31 @@ +# Use official Ubuntu as our base# Use official Ubuntu as our base +FROM opencortex/coros-emu:latest + +# Add required packages in the noninteractive mode +RUN apt-get -y update && apt-get -y -q install curl net-tools build-essential minicom tftpd-hpa git-all subversion openssh-server ncurses-dev php gawk g++ m4 libncurses5-dev texinfo flex bison php-cli vim php-xml python-setuptools python-dev make unzip rsync cpio bc lib32z1 lib32stdc++6 + +# Set the workspace in /sc5xx_dev +ARG TOOLCHAIN_PATH=/sc5xx_dev +RUN mkdir -p ${TOOLCHAIN_PATH} + +# Set the path and name of Patch in /sc5xx_dev/linuxaddin-dockerfile/lib +ARG PATCH_PATH=${TOOLCHAIN_PATH}/lib +ARG PATCH=${PATCH_PATH}/0002-port-to-perl-5.22-and-later.patch + +# Set the Version and Path of cces-linux-add-in. +ARG LINUX_ADDIN_VERSION="1.3.1" + +# Working directory set to /sc5xx_dev +WORKDIR ${TOOLCHAIN_PATH} + +# Copy the install_toolchain.sh to /sc5xx_dev +COPY install_toolchain.sh . +RUN dos2unix install_toolchain.sh && chmod +x install_toolchain.sh && ./install_toolchain.sh ${TOOLCHAIN_PATH} + +# Set toolchain PATH for remote container +ENV PATH=${PATH}:/opt/analog/cces-linux-add-in/${LINUX_ADDIN_VERSION}/ARM/arm-linux-gnueabi/bin/ +ENV QEMU_LD_PREFIX="/opt/analog/cces-linux-add-in/1.3.1/ARM/arm-linux-gnueabi/sysroot" + +WORKDIR / + +ENTRYPOINT ["/bin/bash"] diff --git a/CorOS-dev-environment/CorOS-build-env/docker-compose.yaml b/CorOS-dev-environment/CorOS-build-env/docker-compose.yaml new file mode 100644 index 0000000..6abd5da --- /dev/null +++ b/CorOS-dev-environment/CorOS-build-env/docker-compose.yaml @@ -0,0 +1,21 @@ +# Docker compose file for easy volume mounting and running of the container + +services: + coros-dev: + image: opencortex/coros-dev:latest + build: + context: ../ + dockerfile: CorOS-build-env/Dockerfile + tags: + - opencortex/coros-dev:latest + + volumes: + - ../filesystems:/qc-fs + - ../mount:/mnt + + environment: + # Edit this to your needs. This should be just the file name, not the path. + - UPDATE_FILE=verify.bin.gz + + privileged: true + entrypoint: /bin/bash -c "while true; do sleep 1; done" \ No newline at end of file diff --git a/QC-dev-environment/Dockerfile b/QC-dev-environment/Dockerfile deleted file mode 100644 index e6da7c5..0000000 --- a/QC-dev-environment/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -# Use official Ubuntu as our base# Use official Ubuntu as our base -FROM ubuntu:18.04 as builder - -# Add required packages in the noninteractive mode -RUN apt-get -y update -RUN DEBIAN_FRONTEND=noninteractive apt-get -y -q install curl dos2unix net-tools build-essential minicom tftpd-hpa git-all subversion openssh-server ncurses-dev php gawk g++ m4 libncurses5-dev texinfo flex bison php-cli vim php-xml python-setuptools python-dev make unzip rsync cpio bc lib32z1 lib32stdc++6 qemu qemu-user-static - -# Set the workspace in /sc5xx_dev -ARG TOOLCHAIN_PATH=/sc5xx_dev -RUN mkdir -p ${TOOLCHAIN_PATH} - -# Set the path and name of Patch in /sc5xx_dev/linuxaddin-dockerfile/lib -ARG PATCH_PATH=${TOOLCHAIN_PATH}/lib -ARG PATCH=${PATCH_PATH}/0002-port-to-perl-5.22-and-later.patch - -# Set the Version and Path of cces-linux-add-in. -ARG LINUX_ADDIN_VERSION="1.3.1" - -# Working directory set to /sc5xx_dev -WORKDIR ${TOOLCHAIN_PATH} - -# Copy the install_toolchain.sh to /sc5xx_dev -COPY install_toolchain.sh . -RUN dos2unix install_toolchain.sh -RUN chmod +x install_toolchain.sh -RUN ./install_toolchain.sh ${TOOLCHAIN_PATH} - -# # Set toolchain PATH for remote container -ENV PATH=${PATH}:/opt/analog/cces-linux-add-in/${LINUX_ADDIN_VERSION}/ARM/arm-linux-gnueabi/bin/ -ENV QEMU_LD_PREFIX="/opt/analog/cces-linux-add-in/1.3.1/ARM/arm-linux-gnueabi/sysroot" - -# Mounting the QC-rootfs -RUN mkdir /qc-fs -RUN mkdir /qc-fs-uncompressed - -RUN mkdir -p /qt_src -WORKDIR /qt_src -# # Copy and run the installer -COPY qt-compiled-4.8.7.tar.gz . -COPY install_qt_compiled.sh . - -WORKDIR / -COPY init_system.sh . -COPY update-builder.sh . - -ENTRYPOINT ["/bin/bash"] diff --git a/QC-dev-environment/docker-compose.yaml b/QC-dev-environment/docker-compose.yaml deleted file mode 100644 index 44f870e..0000000 --- a/QC-dev-environment/docker-compose.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Docker compose file for easy volume mounting and running of the container - -services: - cortex-dev: - image: cortex-dev:latest - build: - context: . - dockerfile: Dockerfile - tags: - - cortex-dev:latest - - volumes: - - ./filesystems:/qc-fs - - ./mount:/mnt - - environment: - # Edit this to your needs. This should be just the file name, not the path. - - UPDATE_FILE=verify.bin.gz - - privileged: true - entrypoint: /bin/bash -c "while true; do sleep 1; done" \ No newline at end of file -- cgit v1.2.3 From 2c57afa1e3d61cb4a0801c0eb2c1646f3ad7be60 Mon Sep 17 00:00:00 2001 From: Thomas Van Iseghem Date: Tue, 23 May 2023 19:28:15 +0200 Subject: Improved user interactable scripts --- CorOS-dev-environment/init_system.sh | 39 +++++++++++++++++++++--------- CorOS-dev-environment/update-builder.sh | 43 ++++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 24 deletions(-) diff --git a/CorOS-dev-environment/init_system.sh b/CorOS-dev-environment/init_system.sh index 8b931f9..5009cfa 100644 --- a/CorOS-dev-environment/init_system.sh +++ b/CorOS-dev-environment/init_system.sh @@ -1,5 +1,22 @@ #!/bin/bash +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color +# echo the ascii art banner +echo -e "${YELLOW}" +echo " ____ ______ __ " +echo " / __ \____ ___ ____ / ____/___ _____/ /____ _ __ " +echo " / / / / __ \/ _ \/ __ \/ / / __ \/ ___/ __/ _ \| |/_/ " +echo " / /_/ / /_/ / __/ / / / /___/ /_/ / / / /_/ __/> < " +echo " \____/ .___/\___/_/ /_/\____/\____/_/ \__/\___/_/|_| " +echo " /_/ CorOS emulation environment " +echo -e "${NC}" + +echo -e "${BLUE}========= Initializing CorOS emulation environment =========${NC}" + +echo "" +echo -e "${YELLOW}[!]${NC} Mounting the QC-filesystem, this can take a couple of seconds..." # Decompress archive and mount rootfs.ext3 gunzip -d -k /qc-fs/$UPDATE_FILE # Run tar command on the decompressed file to extract the rootfs.ext3 file @@ -9,33 +26,31 @@ rm /qc-fs/${UPDATE_FILE::-3} echo "Mounting rootfs.ext3" mount -t ext4 /qc-fs-uncompressed/rootfs.ext3 $QEMU_LD_PREFIX -echo "Mounting rootfs.ext3 finished" +echo -e "${YELLOW}Mounting rootfs.ext3 finished!${NC}" +echo "" # Promt the user to install custom QT # if the user types "y" or "Y" then install custom QT -echo "Do you want to install the custom compiled QT? (y/n)" -echo "" -read -n 1 -r -echo "" +read -p "Do you want to install the custom compiled QT? (y/n) " -r if [[ $REPLY =~ ^[Yy]$ ]] then - echo "Installing QT" + echo -e "${YELLOW}[!]${NC} Installing QT" cd /qt_src && ./install_qt_compiled.sh - echo "Installing QT finished" + echo -e "${YELLOW}Installing QT finished${NC}" fi +echo "" # Prompt user to chroot into the $QEMU_LD_PREFIX directory # if the user types "y" or "Y" then chroot into the $QEMU_LD_PREFIX directory # otherwise exit the script -echo "Do you want to chroot into the created QC-filesystem? (y/n)" -echo "" -read -n 1 -r -echo "" +read -p "Do you want to chroot into the created QC-filesystem? (y/n) " -r if [[ $REPLY =~ ^[Yy]$ ]] then echo "" - echo "Chrooting into $QEMU_LD_PREFIX" + echo "[->] Chrooting into $QEMU_LD_PREFIX" + echo $(uname -a) + echo "" chroot $QEMU_LD_PREFIX fi diff --git a/CorOS-dev-environment/update-builder.sh b/CorOS-dev-environment/update-builder.sh index ab4e8b9..da6ea99 100644 --- a/CorOS-dev-environment/update-builder.sh +++ b/CorOS-dev-environment/update-builder.sh @@ -1,23 +1,42 @@ -#!/bin/sh +#!/bin/bash # This script can be used to apply OpenCortex patches to a mounted QC file system # And create a new update file from it # This script is intended to be run from the QC-dev-environment directory BLUE='\033[0;34m' +YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo "${BLUE}========= OpenCortex Update Builder =========${NC}" +# echo the ascii art banner +echo -e "${YELLOW}" +echo -e " ____ ______ __ " +echo -e " / __ \____ ___ ____ / ____/___ _____/ /____ _ __ " +echo -e " / / / / __ \/ _ \/ __ \/ / / __ \/ ___/ __/ _ \| |/_/ " +echo -e " / /_/ / /_/ / __/ / / / /___/ /_/ / / / /_/ __/> < " +echo -e " \____/ .___/\___/_/ /_/\____/\____/_/ \__/\___/_/|_| " +echo -e " /_/ CorOS update builder " +echo -e "${NC}" -cd /qc-fs-uncompressed +echo "This tool can be used to create a new update file based on the mounted CorOS file system" +echo -e "${BLUE}========= OpenCortex Update Builder =========${NC}" + +read -p "Do you want create a new update package from the current mounted CorOS? (y/n) " -r + +if [[ $REPLY =~ ^[Yy]$ ]] +then + cd /qc-fs-uncompressed + + echo "" + echo -e "${YELLOW}[!]${NC} Building update file..." + echo "" + tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb + echo "" + echo -e "${YELLOW}[!]${NC} Creating archive. This can take some seconds, please wait..." + gzip -k update-opencortex.bin + cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz + echo "" + echo -e "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" +fi echo "" -echo "${BLUE}[+]${NC} Building update file..." -echo "" -tar cvf update-opencortex.bin rootfs.ext3 uImage zpu.dtb -echo "" -echo "This can take some seconds, please wait..." -gzip -k update-opencortex.bin -cp update-opencortex.bin.gz /qc-fs/update-opencortex.bin.gz -echo "" -echo "${BLUE}[+]${NC} Update file created: update-opencortex.bin.gz" \ No newline at end of file -- cgit v1.2.3