当前位置:网站首页>Jestson Nano自定义根文件系统创建(支持NVIDIA图形库的最小根文件系统)
Jestson Nano自定义根文件系统创建(支持NVIDIA图形库的最小根文件系统)
2022-07-03 09:03:00 【蒙蒂锅巴】
前面两篇,我们通过裁剪内核,构造了一个自定义内核,但是官方的根文件系统太大,有13G之多,而nano的emmc版本带的flash只有16gb,所以,根文件系统的裁剪势在必行。基于此,我们根据ubuntu基本的根文件创建自己的自定义文件系统。
整个过程我参考官网论坛的一些资料,做成了两个脚本,直接放在一个目录里面运行
sudo ./make_rootfs
即可在当前目录下的build目录下生成根文件系统,将build目录下的所有文件复制到/Linux_for_Tegra/rootfs目录下,运行以下指令:
cd ..
sudo ./apply_binaries.sh
这一步是用来安装NVIDIA的图形加速库,如果不运行,就失去了用这个板子的意义。
后面直接运行flash.sh脚本烧录即可!(烧录方法参见前两篇)
脚本:make_rootfs.sh
#!/bin/bash
URL_ROOTFS_TGZ_BASE=http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/ubuntu-base-18.04.5-base-arm64.tar.gz
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
SOURCE_DIR="$( cd "$( dirname "${
BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" BUILD_DIR=$SOURCE_DIR/build rm -r $BUILD_DIR mkdir -p $BUILD_DIR cd $BUILD_DIR # download and extract rootfs wget -O rootfs.tar.gz $URL_ROOTFS_TGZ_BASE tar -xpf rootfs.tar.gz rm rootfs.tar.gz # chroot to rootfs QEMU_PATH=/usr/bin/qemu-aarch64-static if [ ! -f "$FILE" ]; then apt-get install qemu-user-static fi cp $QEMU_PATH $BUILD_DIR/usr/bin/ mount /sys $BUILD_DIR/sys -o bind mount /proc $BUILD_DIR/proc -o bind mount /dev $BUILD_DIR/dev -o bind mv $BUILD_DIR/etc/resolv.conf $BUILD_DIR/etc/resolv.conf.saved cp /etc/resolv.conf $BUILD_DIR/etc cp $SOURCE_DIR/install.sh $BUILD_DIR/ LC_ALL=C chroot $BUILD_DIR /bin/bash -c ./install.sh rm $BUILD_DIR/install.sh echo "<================We are unmounting==============>"
umount $BUILD_DIR/sys
umount $BUILD_DIR/proc
umount $BUILD_DIR/dev
mv $BUILD_DIR/etc/resolv.conf.saved $BUILD_DIR/etc/resolv.conf
rm $BUILD_DIR/usr/bin/qemu-aarch64-static
rm -rf $BUILD_DIR/var/lib/apt/lists/*
rm -rf $BUILD_DIR/dev/*
rm -rf $BUILD_DIR/var/log/*
rm -rf $BUILD_DIR/var/tmp/*
rm -rf $BUILD_DIR/var/cache/apt/archives/*.deb
rm -rf $BUILD_DIR/tmp/*
脚本:intstall.sh
有一点需要指出的是,我们增加用户的时候,一般的在命令行直接输入useradd ,然后输入密码,其实可以通过openssl直接设置密码。
useradd -p 密码
只不过这里的密码必须是密文,也就是,我们先通过openssl passwd -crypt来设置密码,然后将密文传入作为p的参数。即
PASSWORD=$(openssl passwd -crypt)
useradd -m -p $PASSWORD -s /bin/bash careray
上面的命令即会按照输入的明文密码,加密后添加用户careray。
#!/bin/bash
# update apt cache
apt-get update
# create user
apt-get install -y openssl
echo "Please provide the default password for the user:"
PASSWORD=$(openssl passwd -crypt)
useradd -m -p $PASSWORD -s /bin/bash careray
usermod -aG sudo careray
# install openssh
apt-get install -y openssh-server
# remove old docker version
apt-get remove \
docker \
docker-engine \
docker.io \
containerd \
runc
# install dependencies
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
binfmt-support \
device-tree-compiler \
libasound2 \
libcairo2 \
libdatrie1 \
libegl1 \
libegl1-mesa \
libevdev2 \
libfontconfig1 \
libgles2 \
libgstreamer-plugins-base1.0-0 \
libgstreamer1.0-0 \
libgtk-3-0 \
libharfbuzz0b \
libinput10 \
libjpeg-turbo8 \
libpixman-1-0 \
libpangocairo-1.0-0 \
libpangoft2-1.0-0 \
libpng16-16 \
libssl-dev \
libunwind8 \
libwayland-cursor0 \
libwayland-egl1 \
libx11-6 \
libxext6 \
libxkbcommon0 \
libxrender1 \
locales \
locate \
nano \
network-manager \
openssh-server \
openssl \
python \
python3 \
python3-pip \
sudo \
v4l-utils \
software-properties-common
# We are required to provide libffi6
wget http://ftp.de.debian.org/debian/pool/main/libf/libffi/libffi6_3.2.1-9_arm64.deb
dpkg --install libffi6_3.2.1-9_arm64.deb
# This has no installation candidate
wget http://ports.ubuntu.com/pool/universe/g/gst-plugins-bad1.0/libgstreamer-plugins-bad1.0-0_1.14.0-1ubuntu1_arm64.deb
dpkg --install libgstreamer-plugins-bad1.0-0_1.14.0-1ubuntu1_arm64.deb
# add docker gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
# #Install multimedia packages
# wget https://repo.download.nvidia.com/jetson/t210/pool/main/n/nvidia-l4t-multimedia/nvidia-l4t-multimedia_32.6.1-20210916211029_arm64.deb
# dpkg --install nvidia-l4t-multimedia/nvidia-l4t-multimedia_32.6.1-20210916211029_arm64.deb
# #Install gstreamer_32
# wget https://repo.download.nvidia.com/jetson/t210/pool/main/n/nvidia-l4t-gstreamer/nvidia-l4t-gstreamer_32.6.1-20210916211029_arm64.deb
# dpkg --install nvidia-l4t-gstreamer_32.6.1-20210916211029_arm64.deb
# add docker repo and install
add-apt-repository \
"deb [arch=arm64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
apt-get update
apt-get install -y \
docker-ce \
docker-ce-cli \
containerd.io
# add user to docker group
usermod -aG docker careray
systemctl set-default multi-user.target
脚本里面的一些下载网址可能会随着官方更新而下载失败,请自行更新!
边栏推荐
- [point cloud processing paper crazy reading classic version 10] - pointcnn: revolution on x-transformed points
- Save the drama shortage, programmers' favorite high-score American drama TOP10
- Detailed steps of windows installation redis
- Hudi learning notes (III) analysis of core concepts
- Run flash demo on ECS
- 【点云处理之论文狂读前沿版9】—Advanced Feature Learning on Point Clouds using Multi-resolution Features and Learni
- [untitled] use of cmake
- CSDN markdown editor help document
- Beego learning - Tencent cloud upload pictures
- 【点云处理之论文狂读前沿版8】—— Pointview-GCN: 3D Shape Classification With Multi-View Point Clouds
猜你喜欢

Spark structured stream writing Hudi practice

Spark cluster installation and deployment
[graduation season | advanced technology Er] another graduation season, I change my career as soon as I graduate, from animal science to programmer. Programmers have something to say in 10 years

LeetCode每日一题(2212. Maximum Points in an Archery Competition)

CATIA automation object architecture - detailed explanation of application objects (III) systemservice

Spark 概述

Digital statistics DP acwing 338 Counting problem

【点云处理之论文狂读经典版10】—— PointCNN: Convolution On X-Transformed Points

LeetCode每日一题(931. Minimum Falling Path Sum)

There is no open in default browser option in the right click of the vscade editor
随机推荐
Notes on numerical analysis (II): numerical solution of linear equations
Using Hudi in idea
[solution to the new version of Flink without bat startup file]
[point cloud processing paper crazy reading frontier version 10] - mvtn: multi view transformation network for 3D shape recognition
Win10 quick screenshot
Flink学习笔记(十一)Table API 和 SQL
[point cloud processing paper crazy reading frontier version 8] - pointview gcn: 3D shape classification with multi view point clouds
Use the interface colmap interface of openmvs to generate the pose file required by openmvs mvs
Crawler career from scratch (I): crawl the photos of my little sister ① (the website has been disabled)
Linxu learning (4) -- Yum and apt commands
Django operates Excel files through openpyxl to import data into the database in batches.
LeetCode每日一题(931. Minimum Falling Path Sum)
Crawler career from scratch (IV): climb the bullet curtain of station B through API
Serializer rewrite: update and create methods
【点云处理之论文狂读前沿版12】—— Adaptive Graph Convolution for Point Cloud Analysis
2022-2-13 learning xiangniuke project - version control
Problems in the implementation of lenet
Vscode编辑器右键没有Open In Default Browser选项
Temper cattle ranking problem
LeetCode每日一题(2090. K Radius Subarray Averages)