当前位置:网站首页>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
脚本里面的一些下载网址可能会随着官方更新而下载失败,请自行更新!
边栏推荐
- Tag paste operator (#)
- 【毕业季|进击的技术er】又到一年毕业季,一毕业就转行,从动物科学到程序员,10年程序员有话说
- Windows安装Redis详细步骤
- Trial of the combination of RDS and crawler
- [point cloud processing paper crazy reading frontier version 8] - pointview gcn: 3D shape classification with multi view point clouds
- Crawler career from scratch (IV): climb the bullet curtain of station B through API
- Spark overview
- Spark 结构化流写入Hudi 实践
- C language programming specification
- 专利查询网站
猜你喜欢
CATIA automation object architecture - detailed explanation of application objects (I) document/settingcontrollers
Build a solo blog from scratch
Spark 概述
[kotlin learning] classes, objects and interfaces - define class inheritance structure
Win10 quick screenshot
Flink学习笔记(八)多流转换
Construction of simple database learning environment
Hudi学习笔记(三) 核心概念剖析
[point cloud processing paper crazy reading classic version 12] - foldingnet: point cloud auto encoder via deep grid deformation
【点云处理之论文狂读前沿版12】—— Adaptive Graph Convolution for Point Cloud Analysis
随机推荐
Spark 结构化流写入Hudi 实践
Flink学习笔记(八)多流转换
Use the interface colmap interface of openmvs to generate the pose file required by openmvs mvs
MySQL installation and configuration (command line version)
CSDN markdown editor help document
The server denied password root remote connection access
Hudi data management and storage overview
CATIA automation object architecture - detailed explanation of application objects (I) document/settingcontrollers
用Redis实现分布式锁
[solution to the new version of Flink without bat startup file]
Banner - Summary of closed group meeting
Crawler career from scratch (3): crawl the photos of my little sister ③ (the website has been disabled)
【点云处理之论文狂读前沿版12】—— Adaptive Graph Convolution for Point Cloud Analysis
Vs2019 configuration opencv3 detailed graphic tutorial and implementation of test code
Notes on numerical analysis (II): numerical solution of linear equations
CATIA automation object architecture - detailed explanation of application objects (III) systemservice
PowerDesigner does not display table fields, only displays table names and references, which can be modified synchronously
Flink学习笔记(十一)Table API 和 SQL
[point cloud processing paper crazy reading frontier version 11] - unsupervised point cloud pre training via occlusion completion
【点云处理之论文狂读经典版10】—— PointCNN: Convolution On X-Transformed Points