aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--QC-dev-environment/.gitignore7
-rw-r--r--QC-dev-environment/Dockerfile44
-rw-r--r--QC-dev-environment/REAME.md77
-rw-r--r--QC-dev-environment/docker-compose.yaml21
-rw-r--r--QC-dev-environment/filesystems/README.md7
-rw-r--r--QC-dev-environment/init_system.sh41
-rw-r--r--QC-dev-environment/install_qt_compiled.sh8
-rw-r--r--QC-dev-environment/install_qt_src.sh4
-rw-r--r--QC-dev-environment/install_toolchain(broken).sh37
-rw-r--r--QC-dev-environment/install_toolchain.sh6
-rw-r--r--QC-dev-environment/qt-compiled-4.8.7.tar.gz3
-rw-r--r--QC-dev-environment/update-builder.sh23
13 files changed, 280 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..edc7a3f
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+QC-dev-environment/filesystems/2.0.0-vanilla.bin.gz filter=lfs diff=lfs merge=lfs -text
+QC-dev-environment/qt-compiled-4.8.7.tar.gz filter=lfs diff=lfs merge=lfs -text
diff --git a/QC-dev-environment/.gitignore b/QC-dev-environment/.gitignore
new file mode 100644
index 0000000..b631c5c
--- /dev/null
+++ b/QC-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/QC-dev-environment/Dockerfile b/QC-dev-environment/Dockerfile
new file mode 100644
index 0000000..a1bd7c4
--- /dev/null
+++ b/QC-dev-environment/Dockerfile
@@ -0,0 +1,44 @@
+# 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 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 ./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/REAME.md b/QC-dev-environment/REAME.md
new file mode 100644
index 0000000..b236306
--- /dev/null
+++ b/QC-dev-environment/REAME.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 <your-wanted-tag e.g. cortex-dev>
+```
+
+### 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 <absolute-path-to-current-folder>/mount:/mnt \
+ -v <absolute-path-to-current-folder>/filesystems:/qc-fs \
+ -e UPDATE_FILE=<update-file-name> \
+ 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/docker-compose.yaml b/QC-dev-environment/docker-compose.yaml
new file mode 100644
index 0000000..9f2943f
--- /dev/null
+++ b/QC-dev-environment/docker-compose.yaml
@@ -0,0 +1,21 @@
+# 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=update-opencortex.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/filesystems/README.md b/QC-dev-environment/filesystems/README.md
new file mode 100644
index 0000000..fc4da30
--- /dev/null
+++ b/QC-dev-environment/filesystems/README.md
@@ -0,0 +1,7 @@
+# Update name registry
+
+Update download files are found inside `/media/p4/update-<update-name>.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
new file mode 100644
index 0000000..8b931f9
--- /dev/null
+++ b/QC-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/QC-dev-environment/install_qt_compiled.sh b/QC-dev-environment/install_qt_compiled.sh
new file mode 100644
index 0000000..2094de0
--- /dev/null
+++ b/QC-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/QC-dev-environment/install_qt_src.sh b/QC-dev-environment/install_qt_src.sh
new file mode 100644
index 0000000..66a381b
--- /dev/null
+++ b/QC-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/QC-dev-environment/install_toolchain(broken).sh b/QC-dev-environment/install_toolchain(broken).sh
new file mode 100644
index 0000000..c3b05fa
--- /dev/null
+++ b/QC-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/QC-dev-environment/install_toolchain.sh b/QC-dev-environment/install_toolchain.sh
new file mode 100644
index 0000000..d4a5465
--- /dev/null
+++ b/QC-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/QC-dev-environment/qt-compiled-4.8.7.tar.gz b/QC-dev-environment/qt-compiled-4.8.7.tar.gz
new file mode 100644
index 0000000..b6c5d9e
--- /dev/null
+++ b/QC-dev-environment/qt-compiled-4.8.7.tar.gz
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 0000000..ab4e8b9
--- /dev/null
+++ b/QC-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