当前位置:首页 > 技术 > LINUX > 正文内容

duo制作ubuntu文件系统

Watrt1年前 (2024-08-25)LINUX10190

在Ubuntu 22.04 LTS下执行:

首先在内核编译中添加以下选项

# We need to enable a few modules in the kernel configuration before we can continue, so:
nano ~/duo-buildroot-sdk/build/boards/cv180x/cv1800b_milkv_duo_sd/linux/cvitek_cv1800b_milkv_duo_sd_defconfig

# and add at the end:
CONFIG_CGROUPS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_CGROUP_SCHED=y
CONFIG_NAMESPACES=y
CONFIG_OVERLAY_FS=y
CONFIG_AUTOFS4_FS=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EPOLL=y
CONFIG_IPV6=y
CONFIG_FANOTIFY

# optional (enable zram):
CONFIG_ZSMALLOC=y
CONFIG_ZRAM=y

重要提示:要减少ram的使用可以关掉duo的保留内存空间

创建rootfs

# install prerequisites
sudo apt install debootstrap qemu qemu-user-static binfmt-support dpkg-cross --no-install-recommends
# generate minimal bootstrap rootfs
sudo debootstrap --arch=riscv64 --foreign jammy ./temp-rootfs http://ports.ubuntu.com/ubuntu-ports
# chroot into the rootfs we just created
sudo chroot temp-rootfs /bin/bash
# run 2nd stage of deboostrap
/debootstrap/debootstrap --second-stage
# add package sources
cat >/etc/apt/sources.list <<EOF
deb http://ports.ubuntu.com/ubuntu-ports jammy main restricted

deb http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted

deb http://ports.ubuntu.com/ubuntu-ports jammy universe
deb http://ports.ubuntu.com/ubuntu-ports jammy-updates universe

deb http://ports.ubuntu.com/ubuntu-ports jammy multiverse
deb http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse

deb http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse

deb http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports jammy-security universe
deb http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse
EOF
# update and install some packages
apt-get update
apt-get install --no-install-recommends -y util-linux haveged openssh-server systemd kmod initramfs-tools conntrack ebtables ethtool iproute2 iptables mount socat ifupdown iputils-ping vim dhcpcd5 neofetch sudo chrony
# optional for zram
apt-get install zram-config
systemctl enable zram-config
# Create base config files
mkdir -p /etc/network
cat >>/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

cat >/etc/resolv.conf <<EOF
nameserver 1.1.1.1
nameserver 8.8.8.8
EOF

# write text to fstab (this is with swap enabled if you want to disable it just put a # before the swap line)
cat >/etc/fstab <<EOF
# <file system>	<mount pt>	<type>	<options>	<dump>	<pass>
/dev/root	/		ext2	rw,noauto	0	1
proc		/proc		proc	defaults	0	0
devpts		/dev/pts	devpts	defaults,gid=5,mode=620,ptmxmode=0666	0	0
tmpfs		/dev/shm	tmpfs	mode=0777	0	0
tmpfs		/tmp		tmpfs	mode=1777	0	0
tmpfs		/run		tmpfs	mode=0755,nosuid,nodev,size=64M	0	0
sysfs		/sys		sysfs	defaults	0	0
/dev/mmcblk0p3  none            swap    sw              0       0
EOF
# set hostname
echo "milkvduo-ubuntu" > /etc/hostname
# set root passwd
echo "root:riscv" | chpasswd
# enable root login through ssh
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
# exit chroot
exit
sudo tar -cSf Ubuntu-jammy-rootfs.tar -C temp-rootfs .
gzip Ubuntu-jammy-rootfs.tar
rm -rf temp-rootfs

然后先把官方的镜像写入到sd卡然后替换内核的文件系统 

dd if=milkv-duo.img of=/dev/sdX status=progress #replace X with your device name

我们挂载rootfs分区,并用bash sudo rm -r /media/yourusername/rootfs然后创建一个目录mkdir ubunturootfs提取我们的Ubuntu-jammy-rootfs.tar

tar -xf Ubuntu-jammy-rootfs.tar -C ubunturootfs

现在,我们将rootfs复制到我们挂载的分区:

sudo cp -r ubunturootfs/* /media/yournamehere/rootfs/


打赏 支付宝打赏 微信打赏
分享给朋友:

相关文章

基于 debootstrap 和 busybox 构建 mini ubuntu

基于 debootstrap 和 busybox 构建 mini ubuntu

最近的工作涉及到服务器自动安装和网络部署操作系统,然后使用 ansible 和 saltsatck 进行配置并安装 openstack 。难点在于服务器的自动安装,由于不单只是通过 PXE 安装服务器,还需要能够安装时进行分区、配置网卡等工作,因此需要在开始安装前,必须先收集服务器的硬件信息。调研了一下目前的开源项目中,提供此类功能的有 tinycorelinux 、 puppet razor-el-mk 可做类似的工作。tinycorelinux 是个很好的工具,整个系统在 PXE 之后在内存...

关于CentOS 下 httpd 修改默认的目录后 403 错误的 解决

关于CentOS 下 httpd 修改默认的目录后 403 错误的 解决

step 1 : 首先改你要设置的目录权限       chmod -R 755 /home/html          -------------->>  /home/html   是你存放你的页面的目录   这里我顺便记录下关于selinux 的命令吧    getenforce=>查看 selinux的状态&nbs...

licheepi_zero开发板 buildroot配置 一键编译

licheepi_zero开发板 buildroot配置 一键编译

开贴记录配置最新buildroot-2018.08.使用buildroot自带工具链一键编译生成uboot,kernel,dtb和rootfs.最新稳定版buildroot下载:buildroot-2018.08.02稳定版我配置好的config文件:配置好的.config本人的开发环境是vmware workstation 15 pro+ubuntu 16.04_x64参照沉鱼的帖子荔枝派Zero V3s开发板入坑记录 (TF/SD卡启动)(主线Linux,主线u-boot)做如下配置:1.t...

荔枝派nano(f1c100s)的SPI-Flash系统编译创建全过程

荔枝派nano(f1c100s)的SPI-Flash系统编译创建全过程

前言本文的目标是创建一个运行在SPI-Flash上的精简系统,附带填一些前人没有提及的坑。在开始之前,请先通读官方教程的即食部分(U-Boot)、Linux编译和SPI-Flash系统的创建部分的教程,并搭建好编译工具链。以下我假设你已经按照上面的教程下载好了U-Boot和Linux内核,并且到Buildroot的官网下载好了Buildroot(但没按教程创建config文件)。SPI-Flash的分区结构以下是我这里的分区结构。你可以自由的分配后面两个分区的大小。ID  S...

利用BusyBox ~私人定制 My LINUX~

利用BusyBox ~私人定制 My LINUX~

前言  我在今天在这里跟大家详细地探讨一下Linux系统的定制过程和实现例如、用户能够远程登录;和Nginx能够稳定地运行在我们私人定制的LINUX系统上、一步一步从头开始定制属于我们自己的系统。正文   首先我们先来简单的介绍一下我们这里定制属于自己的Linux系统的基本元素.   一个定制的linux内核+一个定制的busybox就可以定制一个小型的Linux操作系统了,安装Dropbear和Nginx,Linux的组成 部分包括内核空间和用户空间、而...

 Debian 9.9 (stretch) 文件系统制作

Debian 9.9 (stretch) 文件系统制作

0. 准备工作:sudo apt install qemu-user-static -y sudo apt install debootstrap -y mkdir rootfs1. debootstrapdebootstrap --foreign --verbose --arch=armhf  stretch rootfs http...

[转]《保姆级教程》全志F1C100S/F1C200S spi-flash 启动全流程适配烧录及踩坑指南

[转]《保姆级教程》全志F1C100S/F1C200S spi-flash 启动全流程适配烧录及踩坑指南

转自哇酷网=丨晋丨通过参考荔枝派nano官方和论坛大佬的帖子,总结了烧录 spi-flash 启动的方法。通过搜寻资料,把其中有错误或者做了多余的操作的步骤做了修正,以免大家再次踩坑,耗费青春。以下包括 uboot、kernel、buildroot 和 烧录的详细步骤和需要注意的问题,尽量精简方法,以期容易上手和理解。各种配置项也做了详细注释,要知其然,也知其所以然。最理想的状态应该是是:有的坑,踩的人多了,也便没有了坑。论坛不太好排版,有需要的也可以去我的博客看:P:全志F1C100S/F1C...

修改U-BOOT,输出信息在LCD上显示,并使用USB连接键盘使用控制台

修改U-BOOT,输出信息在LCD上显示,并使用USB连接键盘使用控制台

修改方法:一:修改U-BOOT   include/configs/suniv.h#define CONFIG_BOOTCOMMAND"fatload mmc 0:1 0x80800000 zImage; "  \              &nb...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。