-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Jetson Nano SoC Depends on siderolabs/pkgs#380 Signed-off-by: Noel Georgi <[email protected]>
- Loading branch information
Showing
13 changed files
with
226 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
internal/app/machined/pkg/runtime/v1alpha1/board/jetson_nano/jetson_nano.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
package jetsonnano | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/talos-systems/go-procfs/procfs" | ||
"golang.org/x/sys/unix" | ||
|
||
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime" | ||
"github.com/talos-systems/talos/pkg/copy" | ||
"github.com/talos-systems/talos/pkg/machinery/constants" | ||
) | ||
|
||
// References | ||
// - https://github.com/u-boot/u-boot/blob/v2021.10/configs/p3450-0000_defconfig#L8 | ||
// - https://github.com/u-boot/u-boot/blob/v2021.10/include/configs/tegra-common.h#L53 | ||
// - https://github.com/u-boot/u-boot/blob/v2021.10/include/configs/tegra210-common.h#L49 | ||
var dtb = "/dtb/nvidia/tegra210-p3450-0000.dtb" | ||
|
||
// JetsonNano represents the JetsonNano board | ||
// | ||
// References: | ||
// - https://developer.nvidia.com/embedded/jetson-nano-developer-kit | ||
type JetsonNano struct{} | ||
|
||
// Name implements the runtime.Board. | ||
func (b *JetsonNano) Name() string { | ||
return constants.BoardJetsonNano | ||
} | ||
|
||
// Install implements the runtime.Board. | ||
func (b JetsonNano) Install(disk string) (err error) { | ||
var f *os.File | ||
|
||
if f, err = os.OpenFile(disk, os.O_RDWR|unix.O_CLOEXEC, 0o666); err != nil { | ||
return err | ||
} | ||
//nolint:errcheck | ||
defer f.Close() | ||
|
||
// NB: In the case that the block device is a loopback device, we sync here | ||
// to ensure that the file is written before the loopback device is | ||
// unmounted. | ||
err = f.Sync() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
src := "/usr/install/arm64" + dtb | ||
dst := "/boot/EFI" + dtb | ||
|
||
err = os.MkdirAll(filepath.Dir(dst), 0o600) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = copy.File(src, dst) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// KernelArgs implements the runtime.Board. | ||
// | ||
// References: | ||
// - https://elinux.org/Jetson/Nano/Upstream to enable early console | ||
// - http://en.techinfodepot.shoutwiki.com/wiki/NVIDIA_Jetson_Nano_Developer_Kit for other chips on the SoC | ||
func (b JetsonNano) KernelArgs() procfs.Parameters { | ||
return []*procfs.Parameter{ | ||
procfs.NewParameter("console").Append("tty0").Append("ttyS0,115200"), | ||
// even though PSCI works perfectly on the Jetson Nano, the kernel is stuck | ||
// trying to kexec. Seems the drivers state is not reset properly. | ||
// disabling kexec until we have further knowledge on this | ||
procfs.NewParameter("sysctl.kernel.kexec_load_disabled").Append("1"), | ||
} | ||
} | ||
|
||
// PartitionOptions implements the runtime.Board. | ||
func (b JetsonNano) PartitionOptions() *runtime.PartitionOptions { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
website/content/docs/v0.15/Single Board Computers/jetson_nano.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
title: "Jetson Nano" | ||
description: "Installing Talos on Jetson Nano SBC using raw disk image." | ||
--- | ||
|
||
## Prerequisites | ||
|
||
You will need | ||
|
||
- `talosctl` | ||
- an SD card/USB drive | ||
- [crane CLI](https://github.com/google/go-containerregistry/releases) | ||
|
||
Download the latest `talosctl`. | ||
|
||
```bash | ||
curl -Lo /usr/local/bin/talosctl https://github.com/talos-systems/talos/releases/latest/download/talosctl-$(uname -s | tr "[:upper:]" "[:lower:]")-amd64 | ||
chmod +x /usr/local/bin/talosctl | ||
``` | ||
|
||
## Flashing the firmware to on-board SPI flash | ||
|
||
> Flashing the firmware only needs to be done once. | ||
We will use the [R32.6.1 release](https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/t210/jetson-210_linux_r32.6.1_aarch64.tbz2) for the Jetson Nano. | ||
Most of the instructions is similar to this [doc](https://nullr0ute.com/2020/11/installing-fedora-on-the-nvidia-jetson-nano/) except that we'd be using a patched version of `u-boot` so that USB boot also works. | ||
|
||
Before flashing we need the following: | ||
|
||
- A USB-A to micro USB cable | ||
- A jumper wire to enable recovery mode | ||
- A HDMI monitor to view the logs if the USB serial adapter is not available | ||
- A USB to Serial adapter with 3.3V TTL (optional) | ||
- A 5V DC barrel jack | ||
|
||
If you're planning to use the serial console follow the docuementation [here](https://www.jetsonhacks.com/2019/04/19/jetson-nano-serial-console/) | ||
|
||
First start by downloading the Jetson Nano L4T release. | ||
|
||
```bash | ||
curl -SLO https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/t210/jetson-210_linux_r32.6.1_aarch64.tbz2 | ||
``` | ||
|
||
Next we will extract the L4T release and replace the `u-boot` binary with the patched version. | ||
|
||
```bash | ||
tar xf jetson-210_linux_r32.6.1_aarch64.tbz2 | ||
cd Linux_for_Tegra | ||
crane --platform=linux/arm64 export ghcr.io/talos-systems/u-boot:v0.10.0-alpha.0-11-g5dd08a7 - | tar xf - --strip-components=1 -C bootloader/t210ref/p3450-0000/ jetson_nano/u-boot.bin | ||
``` | ||
|
||
Next we will flash the firmware to the Jetson Nano SPI flash. | ||
In order to do that we need to put the Jetson Nano into Force Recovery Mode (FRC). | ||
We will use the instructions from [here](https://developer.download.nvidia.com/embedded/L4T/r32_Release_v4.4/r32_Release_v4.4-GMC3/T210/l4t_quick_start_guide.txt) | ||
|
||
- Ensure that the Jetson Nano is powered off. | ||
There is no need for the SD card/USB storage/network cable to be connected | ||
- Connect the micro USB cable to the micro USB port on the Jetson Nano, don't plug the other end to the PC yet | ||
- Enable Force Recovery Mode (FRC) by placing a jumper across the FRC pins on the Jetson Nano | ||
- For board revision *A02*, these are pins `3` and `4` of header `J40` | ||
- For board revision *B01*, these are pins `9` and `10` of header `J50` | ||
- Place another jumper across `J48` to enable power from the DC jack and connect the Jetson Nano to the DC jack `J25` | ||
- Now connect the other end of the micro USB cable to the PC and remove the jumper wire from the FRC pins | ||
|
||
Now the Jetson Nano is in Force Recovery Mode (FRC) and can be confirmed by running the following command | ||
|
||
```bash | ||
lsusb | grep -i "nvidia" | ||
``` | ||
|
||
Now we can move on the flashing the firmware. | ||
|
||
```bash | ||
sudo ./flash p3448-0000-max-spi external | ||
``` | ||
|
||
This will flash the firmware to the Jetson Nano SPI flash and you'll see a lot of output. | ||
If you've connected the serial console you'll also see the progress there. | ||
Once the flashing is done you can disconnect the USB cable and power off the Jetson Nano. | ||
|
||
## Download the Image | ||
|
||
Download the image and decompress it: | ||
|
||
```bash | ||
curl -LO https://github.com/talos-systems/talos/releases/latest/download/metal-jetson_nano-arm64.img.xz | ||
xz -d metal-jetson_nano-arm64.img.xz | ||
``` | ||
|
||
## Writing the Image | ||
|
||
Now `dd` the image to your SD card/USB storage: | ||
|
||
```bash | ||
sudo dd if=metal-jetson_nano-arm64.img of=/dev/mmcblk0 conv=fsync bs=4M status=progress | ||
``` | ||
|
||
| Replace `/dev/mmcblk0` with the name of your SD card/USB storage. | ||
|
||
## Bootstrapping the Node | ||
|
||
Insert the SD card/USB storage to your board, turn it on and wait for the console to show you the instructions for bootstrapping the node. | ||
Following the instructions in the console output to connect to the interactive installer: | ||
|
||
```bash | ||
talosctl apply-config --insecure --mode=interactive --nodes <node IP or DNS name> | ||
``` | ||
|
||
Once the interactive installation is applied, the cluster will form and you can then use `kubectl`. | ||
|
||
## Retrieve the `kubeconfig` | ||
|
||
Retrieve the admin `kubeconfig` by running: | ||
|
||
```bash | ||
talosctl kubeconfig | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters