Skip to content
Snippets Groups Projects
Commit a1787549 authored by dylan.frei's avatar dylan.frei
Browse files

added presentation

parent 87471746
Branches
No related tags found
No related merge requests found
File added
File added
......@@ -6,11 +6,179 @@ La société ANTS travaille sur le développement d'une infrastructure de stocka
## Installation
## Usage
The easiest way to set the correctly setup the bootloaders is through the SDK manager. Please flash the SOM once using the SDK manager and the correct storgae device to setup thing properly before using the command line options. We can then proceed with customization :
## Support
- From [the Jetson Developper Webpage](https://developer.nvidia.com/embedded/jetson-linux), download the BSP and sample rootfs. The rootfs is derived from Ubuntu 22.04 and must be unzipped in the rootfs directory of the BSP. The includes a modified version of the ubuntu kernel and the corresponding dtb files for building the dtb.
## Roadmap
```
tar xf Jetson_Linux_R36.2.0_aarch64.tbz2 -C L4T
sudo tar xpf Tegra_Linux_Sample-Root-Filesystem_R36.2.0_aarch64.tbz2 -C L4T/rootfs/
```
- Install the flashing requirements :
```
cd L4T
sudo ./tools/l4t_flash_prerequisites.sh
```
## Generating a SD card blob for flashing
The rootfs previously downloaded from Nvidia doesn't contain anything in /boot. To populate it with the default dtb and kernel provided by Nvidia, run :
```
sudo L4T/apply_binaries.sh
```
Then, generate the SD blob using the jetson image creator script :
```
sudo tools/jetson-disk-image-creator.sh -o myblob.blob -b jetson-orin-nano-devkit -d SD
```
### Flashing the blob
To flash the blob into a SD card, plug the SD card into the host, take note of the mountpoint (my SD card is on /dev/sda) and run :
```
sudo dd if=image.blob of=/dev/sda bs=1M status=progress
```
### customizing rootfs
How the script works :
- Downloads a sample (modifed) ubuntu filesystem from Nvidia
- Chroots into the sample rootfs
- Installs all the packages listed in a file using apt
```
cd L4T/tools/samplefs
sudo ./nv_build_samplefs.sh --abi aarch64 --distro ubuntu --flavor desktop --version jammy
```
Package list stored in (text-file) :
nvubuntu-jammy-desktop-aarch64-packages
Like previously, the rootfs doesn't contain anything in /boot. To generate it automatically, use the apply_binaries script or follow the next sections.
To create a default user and set a few default settings, use l4t_create_user in l4t/tools :
```
Usage:
l4t_create_default_user.sh [-u <username>] [-p <password>] [-a] [-h]
-u | --username - If not specified then default will be set to 'nvidia'.
-p | --password - If not set then randomized password will be generated.
-a | --autologin - If specified autologin will be enabled. Default is disabled
-n | --hostname - If not specified then default will be set to 'tegra-ubuntu'.
-h | --help - print usage
--accept-license - Specified to accept the terms and conditions of EULA
Example:
l4t_create_default_user.sh -u nvidia -p NDZjMWM4
l4t_create_default_user.sh -u ubuntu -a
l4t_create_default_user.sh -n tegra
```
### Creating a custom package list based on ubuntu
To create your own custom list of packages, create a file with the following name : nvubuntu-jammy-[yourcustomname]-aarch64-packages. Add all packages that you desire to the text file. It is recommanded to copy one of the existing file and customize the package list. For instance, I will copy the desktop version file and add the editor "nano" to the package list. I will also remove python3-scipy as I have no use for it.
Then, use the same command but using your custom package list :
```
sudo ./nv_build_samplefs.sh --abi aarch64 --distro ubuntu --flavor [yourcustomname] --version jammy
```
## Setting up the cross compilation toolchain
From [the Jetson Developper Webpage](https://developer.nvidia.com/embedded/jetson-linux), download the Bootlin toolchain for Jetson. Unarchive the binaries and set the cross compilation variable to the correct path :
```
mkdir $HOME/l4t-gcc
cd $HOME/l4t-gcc
tar xf <toolchain_archive>
export CROSS_COMPILE=$HOME/l4t-gcc/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-
```
## Rebuilding kernel from source
From [the Jetson Developper Webpage](https://developer.nvidia.com/embedded/jetson-linux), download the Driver Package (BSP) sources or :
```
wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/sources/public_sources.tbz2
```
Unzip the file and set CROSS_COMPILE variable. Create a directory for the output.
```
tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
export CROSS_COMPILE=$HOME/l4t-gcc/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu- #From section above
TEGRA_KERNEL_OUT=$PWD/kernel_out
mkdir -p $TEGRA_KERNEL_OUT
```
Copy the defconfig file to kernel_out and make modifications according to your wishes :
```
make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
make ARCH=arm64 O=$TEGRA_KERNEL_OUT menuconfig
```
Compile kernel + modules :
```
make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j32 # 32=num of threads
```
Kernel and dts files are located in :
```
/t4l-kernel/arch/arm64/boot/Image
/t4l-kernel/arch/arm64/boot/dts/*
```
Source : https://forums.developer.nvidia.com/t/f2fs-linux-root/191650
## Recompiling the dtb
Decompiling the dtb :
```
dtc -I dtb -O dts -o extracted.dts SomeOriginalTree.dtb
```
Adding a dummy device :
![Extra dtb dummy device](dummydevice.png)
Recompiling the dtb :
```
dtc -I dts -O dtb -o ModifiedSomeOriginalTree.dtb extracted.dts
```
## extlinux.conf
To create a new entry, copy the existing one and modify the appropriate argument :
- LINUX : points to the kernel image
- FDT : points to the dtb
- INITRD : points to the init ramdisk
- APPEND : boot arguments for the kernel
for instance, we can modify the boot arguments as a proof of concept and add a dummy command line argument :
![Extra extlinux entry](extlinux_proof.png)
At boot time, the bootloader will ask you to chose the entry :
![Bootmenu](bootmenu.png)
We can check that the correct entry was selected using the cat command on /proc/cmdline :
![My devkit](custom_arg.png)
## Authors and acknowledgment
......
......@@ -401,7 +401,7 @@ For this addition to the journal, these questions will mainly be answered theori
## Using the Nvidia provided image to investigate
At first, I will be using the blob provided by nvidia that is already ready for SD flashing and mount it on my host to investigate its filesystem. This will allow for in depth research and answer most of our questions easily.
At first, I will be using the blob provided by nvidia that is already ready for SD flashing and mount it on my host to investigate its filesystem. This will allow for in depth research and answer most of our questions easily.
To understand the right partition to mount, I first inspect the .img file :
......@@ -464,7 +464,7 @@ LABEL primary
LINUX /boot/Image
FDT /boot/dtb/kernel_tegra234-p3768-0000+p3767-0005-nv.dtb
INITRD /boot/initrd
APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb video=efifb:off console=tty0
APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb video=efifb:off console=tty0
# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
......@@ -487,5 +487,17 @@ LABEL primary
# APPEND ${cbootargs}
```
The provided file is fairly easy to understand and even explains how to use multiple kernels. For each entry, the kernel image, the DTB, the initrd and the bootargs are configurable. It is possible to have multiple entries to fit our desired scenarii. The kernels should be in image form and located somewhere in the rootfs, preferably in /boot.
The provided file is fairly easy to understand and even explains how to use multiple kernels. For each entry, the kernel image, the DTB, the initrd and the bootargs are configurable. It is possible to have multiple entries to fit our desired scenarii. The kernels should be in image form and located somewhere in the rootfs, preferably in /boot.
# Week 12-15 17.05.2024
The main goal is to confirm everything that we have previously theorized by flashing multiple custom options onto our board. The steps are reported in README.md. The following possibilities have been sucessfully tested :
- Flashing the kit using the SDK manager
- Generating a custom filesystem and customizing the package list
- Recompiling the kernel and dtb
- Using multiple extlinux entries
TODO :
- Modifying the filesystem type
- Modifying default setting such as hostname and network configuration
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment