2021年6月3日 星期四

Jetson nano build custom SD image (L4T 32.5.1)

cd $HOME/JetsonNano

#
# Download L4T Jetson Driver Package
#

wget https://developer.nvidia.com/embedded/l4t/r32_release_v5.1/r32_release_v5.1/t210/jetson-210_linux_r32.5.1_aarch64.tbz2

#
# Download L4T Sample Root File System:
#

wget https://developer.nvidia.com/embedded/l4t/r32_release_v5.1/r32_release_v5.1/t210/tegra_linux_sample-root-filesystem_r32.5.1_aarch64.tbz2

#
# Install QEMU for host
#

sudo apt-get install qemu-user-static

#
# Unpack L4T R32.5.1
#

bzip2 -dc Jetson-210_Linux_R32.5.1_aarch64.tbz2 | tar xvf -

#
# Unpack simple root filesystem
#

cd Linux_for_Tegra/rootfs/
sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R32.5.1_aarch64.tbz2

#
# Apply binary
#

cd ../
sudo ./apply_binaries.sh

#
# Correct apt source (t210 for jetson nano)
#

cd rootfs/
sudo vi etc/apt/sources.list.d/nvidia-l4t-apt-source.list

-deb https://repo.download.nvidia.com/jetson/<SOC> r32.5 main
+deb https://repo.download.nvidia.com/jetson/t210 r32.5 main

#
# Chang root to install custom package / software
#

cd ../../
git clone https://github.com/mdegans/enter_chroot.git
sudo cp enter_chroot/enter_chroot.sh /usr/bin/

sudo enter_chroot.sh Linux_for_Tegra/rootfs/

cd /
rm -rf README.txt

apt update

@@@ Install every thing else @@@

apt install cuda-core-10.2
...
...

exit

#
# Build custom SD image (-r 300 for jetson nano H/W B01)
#

cd Linux_for_Tegra/
sudo tools/jetson-disk-image-creator.sh -o sd-blob-b01.img -b jetson-nano -r 300

#
# Reference
#







2021年5月28日 星期五

Jetson nano clone SD card (For Jetpack 4.5.1)

 The actual size of SD card is different from each other. It will be problem when SD card image file size is large than target SD card.

sudo gunzip -c ~/dragon-eye.img.gz | sudo dd of=/dev/mmcblk0 bs=64k status=progress
62261100544 bytes (62 GB, 58 GiB) copied, 3227 s, 19.3 MB/s
dd: error writing '/dev/mmcblk0': No space left on device
146314+1607917 records in
146314+1607916 records out
62277025792 bytes (62 GB, 58 GiB) copied, 3266.33 s, 19.1 MB/s

Jetson nano will refuse to boot with this SD card. 
I found a procedure to fix the probelm

1.Shrink APP partition (ext4) before clone SD card to image file. Reserve 512MB space on tail.









2.Clone SD card to image file

sudo dd if=/dev/mmcblk0 conv=sync,noerror bs=64K status=progress | gzip -c > ~/dragon-eye.img.gz
[sudo] password for gigijoe: 
62306058240 bytes (62 GB, 58 GiB) copied, 1309 s, 47.6 MB/s
951808+0 records in
951808+0 records out
62377689088 bytes (62 GB, 58 GiB) copied, 1310.95 s, 47.6 MB/s

3.Copy image file to target SD card

sudo gunzip -c ~/dragon-eye.img.gz | sudo dd of=/dev/mmcblk0 bs=64k status=progress
[sudo] password for gigijoe: 
62261100544 bytes (62 GB, 58 GiB) copied, 3227 s, 19.3 MB/s
dd: error writing '/dev/mmcblk0': No space left on device
146314+1607917 records in
146314+1607916 records out
62277025792 bytes (62 GB, 58 GiB) copied, 3266.33 s, 19.1 MB/s

There's error of no space. It's ok, just ignore it.

4.Fix partition

This SD card is NOT ready to boot because the partition table is corrupt. Run gdisk and write back partition table to fix.

sudo gdisk /dev/mmcblk0 

GPT fdisk (gdisk) version 1.0.5

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help): p
Disk /dev/mmcblk0: 121634816 sectors, 58.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): CEF61F19-EF34-40C6-B658-4039F0AB5630
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 121634782
Partitions will be aligned on 2048-sector boundaries
Total free space is 1079229 sectors (527.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1           28672       120584191   57.5 GiB    8300  APP

Recovery/transformation command (? for help): w
Caution! Secondary header was placed beyond the disk's limits! Moving the
header, but other problems may occur!

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mmcblk0.
The operation has completed successfully.

Now the SD card works ...




2021年5月19日 星期三

dragon-eye - F3F real-time electronic judging system with Jetson Nano (Update May 20)

This is update of dragon-eye


There are so many bug fix and update of dragon-eye these month. Now, I think dragon-eye is ready for practice F3F competition. Two dragon-eye bases, an outdoor wifi AP, an Android phone with APP (dragon-eye-rc) and speaker are all we need.


New feature of dragon-eye

1.Improve object tracking performance especially for the object under horizon line.

2.Two cameras are available, each with a different field of view. The conditions and base placement on individual slopes will determine which camera is appropriate for the local slope.

3.Fake Target Detection records all new targets in the previous 3 seconds, if there are targets that overlap too many times these targets will be treated as a fake target and will not trigger the system.

4.Bug trigger is to prevent false triggers caused by bugs flying through the field of view. Bugs are usually small and fast, so targets that are small in size and at high speed will not cause a  trigger when they cross the central line.

5.Save real-time video to the  SD card. The maximum number of video files is 400, each video is about 90 seconds. Access to the video file is available through Windows network sharing (Samba).

6.Show Result, Show detection, trigger and various information on video output is selectable for display on the video output.

7.Across central line trigger through multicast & UDP socket

8.A setup note document dragon-eye setup note

9.Supports 9 axis IMU (Experimental)

For more detail please refer to dragon-eye

New feature of dragon-eye-rc Android APP

1.Android APP F3F timer with voice & audio sound.
2.Android APP supports more than two dragon-eye bases
3.Show temperature and GPU usage of dragon-eye on main page of Android APP
4.Detection of wifi connection. Once wifi reconnect, reflash base list

Setup of dragon-eye base A


Setup of dragon-eye base B


Outdoot wifi AP & Android phone


F3F timer and speaker on the ground


Running video on slope


Running video during sunset


Screenshot of RTSP video on Android APP with detection and tracking result


Screenshot of main page of Android APP showing status of dragon-eye base


Screenshot of system settings of Android APP


Screenshot of camera settings of Android APP


Screenshot of F3F timer of Android APP


About information





2021年4月13日 星期二

Jetson nano clone SD card

 Kingston Canvas Select Plus microSDXC UHS-I U1 V10 A1 64GB

 sudo parted -l

Model: SD SD64G (sd/mmc)

Disk /dev/mmcblk0: 64.1GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags: 


Number  Start   End     Size    File system  Name     Flags

 2      1049kB  1180kB  131kB                TBC

 3      2097kB  2556kB  459kB                RP1

 4      3146kB  3736kB  590kB                EBT

 5      4194kB  4260kB  65.5kB               WB0

 6      5243kB  5439kB  197kB                BPF

 7      6291kB  6685kB  393kB                BPF-DTB

 8      7340kB  7406kB  65.5kB               FX

 9      8389kB  8847kB  459kB                TOS

10      9437kB  9896kB  459kB                DTB

11      10.5MB  11.3MB  786kB                LNX

12      11.5MB  11.6MB  65.5kB               EKS

13      12.6MB  12.7MB  81.9kB               BMP

14      13.6MB  13.8MB  131kB                RP4

 1      14.7MB  64.1GB  64.1GB  ext4         APP



sudo dd if=/dev/mmcblk0 conv=sync,noerror bs=64K status=progress | gzip -c > ~/dragon-eye.img.gz

977728+0 records in
977728+0 records out
64076382208 bytes (64 GB, 60 GiB) copied, 1316.25 s, 48.7 MB/s


sudo gunzip -c ~/dragon-eye.img.gz | sudo dd of=/dev/mmcblk0 bs=64k status=progress

117838+1719780 records in
117838+1719780 records out
64076382208 bytes (64 GB, 60 GiB) copied, 2329.99 s, 27.5 MB/s



2021年3月25日 星期四

Jetson Nano Samba Server

1.Install samba

$ sudo apt-get install samba -y

2.Edit /etc/samba/smb.conf

...
[Videos]
   comment = Samba on JetsonNano
   path = /home/gigijoe/Videos
   read only = no
   public = yes
   browsable = yes
   directory mask = 775

3.Restart Samba Server

$ sudo service smbd restart

4.Setup Samba username / password

$ sudo smbpasswd -a gigijoe

5.Open File Viewer and enter URI

smb://192.168.168.67


2021年3月8日 星期一

Jetson Nano EDIMAX EW-7811Un V2 N150 predictible interface names

1. Create new file

/etc/udev/rules.d/10-network-device.rules

with following line

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="wlanX"

Replacing xx:xx:xx:xx:xx:xx with your device's lowercase mac address (found with ip link) and wlanX with whatever name you choose. 

2.Test

iwconfig

wlan0     IEEE 802.11  Mode:Master  Tx-Power=22 dBm   

          Retry short limit:7   RTS thr:off   Fragment thr:off

          Power Management:on

          

rndis0    no wireless extensions.


lo        no wireless extensions.


l4tbr0    no wireless extensions.


wlan9     unassociated  ESSID:""  Nickname:"<WIFI@REALTEK>"

          Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated   

          Sensitivity:0/0  

          Retry:off   RTS thr:off   Fragment thr:off

          Power Management:off

          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


dummy0    no wireless extensions.


usb0      no wireless extensions.


eth0      no wireless extensions.

Reference

Jetson Nano EDIMAX EW-7811Un V2 N150 as Access Point

1.Build hostapd from source 

cd rtl8188eu/hostapd-0.8/hostapd/

cp defconfig .config

make

2.Edit script control_ap for start / stop AP

cd ../..

diff --git a/control_ap b/control_ap

index c7dbb95..b055c10 100755

--- a/control_ap

+++ b/control_ap

@@ -34,7 +34,7 @@ esac

 IPTABLES=/sbin/iptables

 IFCONFIG=/sbin/ifconfig

 DHCPD=/usr/sbin/dhcpd

-HOSTAPD=/home/finger/rtl8188eu/hostapd-0.8/hostapd/hostapd

+HOSTAPD=/home/gigijoe/rtl8188eu/hostapd-0.8/hostapd/hostapd

 

 # Symbols for AP and external interfaces

 

@@ -75,9 +75,9 @@ start)

         $IFCONFIG $NET_AP up

         $IFCONFIG $NET_AP $AP_ADDR.1

         # dhcpd needs to have a leases file available - create it if needed

-        if [ ! -f /var/lib/dhcp/db/dhcpd.leases ]; then

-               mkdir -p /var/lib/dhcp/db

-                touch /var/lib/dhcp/db/dhcpd.leases

+        if [ ! -f /var/lib/dhcp/dhcpd.leases ]; then

+               mkdir -p /var/lib/dhcp/

+                touch /var/lib/dhcp/dhcpd.leases

         fi

        # Write the DHCP server configuration file

        echo "option domain-name-servers $NAME_SERVER;" > ~/dhcpd.conf

3.Edit /etc/NetworkManager/NetworkManager.conf to unmanager the device

[keyfile]
unmanaged-devices=mac:<hwaddr>

4.Start AP (Default AP SSID is rtwap password 87654321)

sudo ./control_ap start wlan1 eth0

Starting AP mode for wlan1 at address 192.168.0.1

Internet Systems Consortium DHCP Server 4.3.5

Copyright 2004-2016 Internet Systems Consortium.

All rights reserved.

For info, please visit https://www.isc.org/software/dhcp/

Config file: /home/gigijoe/dhcpd.conf

Database file: /var/lib/dhcp/dhcpd.leases

PID file: /var/run/dhcpd.pid

Wrote 0 leases to leases file.

Listening on LPF/wlan1/08:be:ac:15:13:34/192.168.0.0/24

Sending on   LPF/wlan1/08:be:ac:15:13:34/192.168.0.0/24

Sending on   Socket/fallback/fallback-net

random: Trying to read entropy from /dev/random

Configuration file: /home/gigijoe/hostapd.conf

ctrl_interface_group=0

drv->ifindex=8

l2_sock_recv==l2_sock_xmit=0x0x55959e14d0

BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)

Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=12 freq=2467 MHz max_tx_power=0 dBm

Allowed channel: mode=1 chan=13 freq=2472 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=0 dBm

Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=40 freq=5200 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=44 freq=5220 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=48 freq=5240 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=149 freq=5745 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=153 freq=5765 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=157 freq=5785 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=161 freq=5805 MHz max_tx_power=0 dBm

Allowed channel: mode=2 chan=165 freq=5825 MHz max_tx_power=0 dBm

Completing interface initialization

Mode: IEEE 802.11g  Channel: 11  Frequency: 2462 MHz

RATE[0] rate=10 flags=0x1

RATE[1] rate=20 flags=0x1

RATE[2] rate=55 flags=0x1

RATE[3] rate=110 flags=0x1

RATE[4] rate=60 flags=0x0

RATE[5] rate=90 flags=0x0

RATE[6] rate=120 flags=0x0

RATE[7] rate=180 flags=0x0

RATE[8] rate=240 flags=0x0

RATE[9] rate=360 flags=0x0

RATE[10] rate=480 flags=0x0

RATE[11] rate=540 flags=0x0

Flushing old station entries

Deauthenticate all stations

+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2

rtl871x_set_key_ops

rtl871x_set_key_ops

rtl871x_set_key_ops

rtl871x_set_key_ops

Using interface wlan1 with hwaddr 08:be:ac:15:13:34 and ssid 'rtwap'

Deriving WPA PSK based on passphrase

SSID - hexdump_ascii(len=5):

     72 74 77 61 70                                    rtwap           

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

PSK (from passphrase) - hexdump(len=32): [REMOVED]

rtl871x_set_wps_assoc_resp_ie

rtl871x_set_wps_beacon_ie

rtl871x_set_wps_probe_resp_ie

random: Got 20/20 bytes from /dev/random

Get randomness: len=32 entropy=0

GMK - hexdump(len=32): [REMOVED]

Get randomness: len=32 entropy=0

Key Counter - hexdump(len=32): [REMOVED]

WPA: group state machine entering state GTK_INIT (VLAN-ID 0)

Get randomness: len=16 entropy=0

GTK - hexdump(len=16): [REMOVED]

WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)

rtl871x_set_key_ops

rtl871x_set_beacon_ops

wlan1: Setup of interface done.


iwconfig

wlan1     IEEE 802.11bgn  ESSID:"rtwap"  Nickname:"<WIFI@REALTEK>"
          Mode:Master  Frequency:2.462 GHz  Access Point: 08:BE:AC:15:13:34   
          Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=-36 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


5.Stop AP

sudo ./control_ap stop

Reference

https://wiki.archlinux.org/index.php/Software_access_point_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)