Compare commits

...

6 Commits

Author SHA1 Message Date
dchvs daddb2f4f5 documentation: Add REAME 2021-02-19 23:00:33 -06:00
dchvs e51328e1ce documentation: Add architecture diagram 2021-02-19 23:00:33 -06:00
dchvs 8b3e84226c Add EG25-G Driver submodule 2021-02-19 23:00:33 -06:00
dchvs f57121c1c8 Add CTI BSP submodule 2021-02-19 23:00:33 -06:00
dchvs 69d0b29476 Add MT9M021 Driver submodule 2021-02-19 23:00:33 -06:00
dchvs 66e493e847 Add Jetpack submodule
Update repository organization
2021-02-19 23:00:33 -06:00
11 changed files with 114 additions and 47 deletions

18
.gitmodules vendored
View File

@ -1,16 +1,16 @@
[submodule "Jetpack"]
path = Jetpack
[submodule "source/Jetpack"]
path = source/Jetpack
url = https://git.spirirobotics.com/dchvs/Jetpack.git
branch = cti-jetpack-4.4.1
[submodule "source/drivers/li-mt9m021"]
path = source/drivers/li-mt9m021
url = https://git.spirirobotics.com/dchvs/li-mt9m021.git
branch = jetpack-4.4.1
[submodule "CTI-L4T"]
path = CTI-L4T
url = https://git.spirirobotics.com/dchvs/CTI-L4T.git
branch = 4.4.1/feature/install-script-on-level2-directory
[submodule "li-mt9m021"]
path = li-mt9m021
url = https://git.spirirobotics.com/dchvs/li-mt9m021.git
branch = jetpack-4.4.1
[submodule "eg25-g"]
path = eg25-g
[submodule "source/drivers/eg25-g"]
path = source/drivers/eg25-g
url = https://git.spirirobotics.com/dchvs/eg25-g.git
branch = master
branch = 4.4.1/tx2-cti/quectel-module

@ -1 +0,0 @@
Subproject commit f578b9924372cc7439f7122be030fc9e93a28203

137
README.md
View File

@ -1,60 +1,127 @@
The installation consists on creating a build area locatated at:
## Spiri cameras project installation
```bash
Linux_for_Tegra/builds/build_<spiri>
```
From this directory you might call the targets ```tegra_defconfig, dtbs, Image, modules``` to compile the Kernel. Please, add your projects under builds/.
The Make targets gets sourced from the ```source/``` directory on the Jetpack workspace root, which is where this project Kernel sources are installed.
* The ```-C``` flag for the make allows to change the directory where the Kernel source is.
* The ```-O``` stands for the output of the build process files.
* CROSS_COMPILE=${CROSS_COMPILE}, passes the C cross compiler. The recomended for this CTI release it's ```/opt/gcc-linaro-7.3.1/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-```.
* The ```-jN```is the flag for the parallel jobs to build with. You can find it out at your host with the command `nproc`.
### 1. Download the Toolchain for crosscompiling
```bash
wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
sudo tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C /opt/gcc-linaro-7.3.1/
echo "export CROSS_COMPILE=/opt/gcc-linaro-7.3.1/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" >> ~/.bashrc
source ~/.bashrc
```
### 2. Clone recursively the repository to the workspace's root to add the Jetpack+CTI 4.4.1 and Drivers MT9M021 and EG25-G
```bash
LINUX_FOR_TEGRA=<Linux_for_Tegra/ path>
cd $LINUX_FOR_TEGRA
# Clone the repository to the workspace
git clone --recurse-submodules https://git.spirirobotics.com/dchvs/spiri-project.git
cd spiri-project
git checkout 4.4.1/tx2-cti/camera-driver-dev
git checkout master
git submodule update --init --recursive --remote
# Install the CTI BSP
cd CTI-L4T/
sudo ./install.sh
# Install the Jetpack+CTI 4.4.1 and Driver MT9M021 to source/ directory
cd $LINUX_FOR_TEGRA
mkdir source/ && cd source/
cp -r ../spiri-project/Jetpack/* .
cp -r ../spiri-project/li-mt9m021/ .
# Compile the sources
cd $LINUX_FOR_TEGRA
mkdir -p builds/build_<this build name> && cd builds/build_<this build name>
mkdir build modules
make -C ../../source/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ tegra_defconfig
make -C ../../source/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ menuconfig
make -C ../../source/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ CROSS_COMPILE=${CROSS_COMPILE} -j8 --output-sync=target zImage dtbs modules
make -C ../../source/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ modules_install INSTALL_MOD_PATH=$PWD/modules
```
## Flash the Spiri MU
### 3. Install the CTI BSP
```bash
cd CTI-L4T/
sudo ./install.sh
```
### 4. Build the Spiri cameras project Kernel
```bash
cd $LINUX_FOR_TEGRA/
mkdir -p builds/build_<this build name> && cd builds/build_<this build name>
mkdir build modules
# Create the Kernel configuration file
make -C ../../spiri-project/source/Jetpack/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ tegra_defconfig
```
```bash
# Check for the Drivers with the "spiri" keyword
make -C ../../spiri-project/source/Jetpack/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ menuconfig
```
By default the Drivers are installed, the tegra_defconfig include them as:
```CONFIG_VIDEO_I2C_SPIRI_CAM=y```
```CONFIG_VIDEO_I2C_SPIRI_GSM=y```
You can review it on the Kernel Menuconfig, and find it out in the following paths:
```bash
+----------------+ +--------------------+ +-------------------------------------------------------------------+ +-------------------------------------+
| Device Drivers | --> | Multimedia support | --> | NVIDIA overlay Encoders, decoders, sensors and other helper chips | --> | Spiri MT9M021 camera sensor support |
+----------------+ +--------------------+ +-------------------------------------------------------------------+ +-------------------------------------+
+----------------+ +------------------------+ +----------------------+ +----------------------+
| Device Drivers | --> | Network device support | --> | USB Network Adapters | --> | USB Network Adapters |
+----------------+ +------------------------+ +----------------------+ +----------------------+
```
```bash
# Build the Kernel, DTBs and modules
make -C ../../spiri-project/source/Jetpack/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ CROSS_COMPILE=${CROSS_COMPILE} -j8 --output-sync=target zImage dtbs modules
make -C ../../spiri-project/source/Jetpack/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ modules_install INSTALL_MOD_PATH=$PWD/modules
```
The deployed Kernel binaries after compilation could check if it has the Drivers in it, inspecting on it with rgrep:
```bash
rgrep mt9m021 build/arch/arm64/boot/Image
rgrep eg25-g build/arch/arm64/boot/Image
```
### 5. Flash the Spiri Mu
Once the Kernel it's compiled, the output binaries should get installed on the Jetpack workspace, letting the flash scripts deploy them into the target device. The update for the flash scripts deployment it's ilustrated as follows:
```bash
# Location for the Kernel files to be found by Tegra flash.sh script in full image installation
+-----------------------------+ +--------------+
| build/arch/arm64/boot/Image | --> | kernel/Image |
+-----------------------------+ +--------------+
+-----------------------------+ +-------------+
| build/arch/arm64/boot/dts/* | --> | kernel/dtb/ |
+-----------------------------+ +-------------+
+------------------------------------+ +---------------------+
| modules/lib/modules/4.9.140-tegra/ | --> | rootfs/lib/modules/ |
+------------------------------------+ +---------------------+
```
```
# Backup the default Kernel
cp -r ../../kernel/dtb/ ../../kernel/backup_dtb/
cp ../../kernel/Image ../../kernel/backup_Image
sudo mv ../../rootfs/lib/modules/4.9.140-tegra/ ../../rootfs/lib/modules/backup_4.9.140-tegra/
# Install the Kernel
# Add the Kernel files for full image installation
cp build/arch/arm64/boot/dts/* ../../kernel/dtb/
cp build/arch/arm64/boot/Image ../../kernel/
sudo make -C ../../source/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ modules_install INSTALL_MOD_PATH=$PWD/../../rootfs/
# Flash the Spiri MU
cd $LINUX_FOR_TEGRA
sudo ./flash.sh jetson-tx2 mmcblk0p1
sudo make -C ../../spiri-project/source/Jetpack/kernel/kernel-4.9/ ARCH=arm64 O=$PWD/build/ modules_install INSTALL_MOD_PATH=$PWD/../../rootfs/
```
## Capture test
In order to flash the target device, do the following commands from the workspace's root:
```bash
# Sender endpoint
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12,framerate=(fraction)30/1' ! omxh264enc control-rate=2 bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! rtph264pay mtu=1400 ! udpsink host=$HOST_IP port=5000 sync=false async=false
cd $LINUX_FOR_TEGRA/
# Full OS installation
sudo ./flash.sh jetson-tx2 mmcblk0p1
# Device tree installation
sudo ./flash.sh -r -k kernel-dtb -d kernel/dtb/tegra186-tx2-spiri-revF+.dtb jetson-tx2 mmcblk0p1
# Kernel image installation
sudo ./flash.sh -r -k kernel -K kernel/Image jetson-tx2 mmcblk0p1
# Receiver endpoint
gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp,media=(string)video,payload=(int)96,clock-rate=(int)90000,encoding-name=(string)H264" ! rtph264depay ! queue ! avdec_h264 ! xvimagesink sync=true async=false
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

1
eg25-g

@ -1 +0,0 @@
Subproject commit 480df7a9f40a98df7355970373aed26792c74e1c

@ -1 +0,0 @@
Subproject commit 6b9e2b6b54c1d03ca81339ef91ad24ab4722a89b

1
source/Jetpack Submodule

@ -0,0 +1 @@
Subproject commit 95c069085f35530c71e4d216cbb298a917532e4b

1
source/drivers/eg25-g Submodule

@ -0,0 +1 @@
Subproject commit 8ef1521acd107421302ce1c39dbf3b15e9c69da4

@ -0,0 +1 @@
Subproject commit a606c4ece1c00195ea7fcaaf9ced561fb9bf992f