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

Ubuntu 运行在 Milk-V Duo上

Watrt1年前 (2024-05-15)LINUX11250

设置

我们需要在内核配置中启用几个模块,然后才能继续,

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使用量,,要增加rootfs分区大小,您可以编辑duo-buildroot-sdk/milkv/genimage-milkv-duo.cfg在第16行替换为size = 256M或者size = 1G或更高的值,重新打包

创建文件系统

安装必备组件

sudo apt install debootstrap qemu qemu-user-static binfmt-support dpkg-cross --no-install-recommends

生成最小的引导根文件

sudo debootstrap --arch=riscv64 --foreign jammy ./temp-rootfs http://ports.ubuntu.com/ubuntu-ports

chroot进入我们刚刚创建的rootfs

sudo chroot temp-rootfs /bin/bash

运行第二阶段

/debootstrap/debootstrap --second-stage

添加源

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

更新源

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

# 优化内存占用

apt-get install zram-config
systemctl enable zram-config

创建基础配置文件

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

将文本写入fstab(这是在启用了交换的情况下进行的,如果您想禁用它,只需在交换行前加一个#即可)

cat >/etc/fstab <<EOF
# <file system><mount pt><type><options><dump><pass>
/dev/root/ext2rw,noauto01
proc/procprocdefaults00
devpts/dev/ptsdevptsdefaults,gid=5,mode=620,ptmxmode=066600
tmpfs/dev/shmtmpfsmode=077700
tmpfs/tmptmpfsmode=177700
tmpfs/runtmpfsmode=0755,nosuid,nodev,size=64M00
sysfs/syssysfsdefaults00
/dev/mmcblk0p3  none            swap    sw              0       0
EOF

设置主机名

echo "milkvduo-ubuntu" > /etc/hostname

设置密码

echo "root:riscv" | chpasswd

开启SSH登陆

sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config

# 退出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/

仅此而已!你现在应该可以毫无问题地启动到ubuntu了

引用位置:https://github.com/bassusteur/milkv-duo-ubuntu

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

相关文章

为自己打造Linux小系统

为自己打造Linux小系统

 一、前言Linux操作系统至1991.10.5号诞生以来,就源其开源性和自由性得到了很多技术大牛的青睐,每个Linux爱好者都为其贡献了自己的一份力,不管是在Linux内核还是开源软件等方面,都为我们后来人提供了一个良好的学习和研究环境。做为一个Linuxer,感谢各位前辈们为我们提供一个自由的空间,让我们也能够在学习的同时去研究Linux。本文主要通过裁剪现有Linux系统,打造一个属于自己的Linux小系统,让其能够装载网卡驱动,并配置IP地址,实现网络功能。二、原理启动流程介绍...

Linux 压缩解压命令备忘

Linux 压缩解压命令备忘

01-.tar格式解包:[*******]$ tar xvf FileName.tar 打包:[*******]$ tar cvf FileName.tar DirName(注:tar是打包,不是压缩!) 02-.gz格式 解压1:[*******]$ gunzip FileName.gz 解压2:[*******]$ gzip -d FileName.gz 压 缩:[*******]$ gzip...

基于 debootstrap 和 busybox 构建 mini ubuntu

基于 debootstrap 和 busybox 构建 mini ubuntu

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

制作荔枝派Zero开发板(全志V3s) TF/SD卡启动盘

制作荔枝派Zero开发板(全志V3s) TF/SD卡启动盘

0. 前言近几天买了一块荔枝派0开发板,以及官方配的480×272的屏幕。让我记录一下入坑与采坑过程。1. u-boot的编译git clone https://github.com/Lichee-Pi/u-boot -b v3s-current cd u-boot make ARCH=arm LicheePi_Zero_480x272LCD_defconfig make ARCH=arm CROSS...

Linux系统信息查看命令大全

Linux系统信息查看命令大全

最近看了一些Linux命令行的文章,在系统信息查看方面学到不少命令。想起以前写过的一篇其实Linux这样用更简单,发现这些系统信息查看命令也可以总结出一篇小小的东西来了。另外这里还有非常多的命令,可以作为参考。系统# uname -a               # 查看内核/操作系统/CPU信息# head -n 1 /etc/issue   # 查看操作系统版本# cat /proc/cpuinfo  ...

Deepin Linux修复grub引导

Deepin Linux修复grub引导

环境说明:一直使用的是Win7+Deepin 15.5。后来全新安装了Win 10,需要修复grub第一步:在Windows操作系统下使用深度官方的U盘启动制作器 制作U盘第二步:开机U盘启动进入Deepin linux安装界面,待进入到安装界面选择语言时,按住Crtl+Alt+F2/F1进入Linux tty终端。并执行以下命令完成修复sudo fdisk -l/*根据查询结果确定deepin 的/目录和/boot目录所在的分区编号*/sudo mount&nbs...

buildroot编译中的问题

buildroot编译中的问题

在编译中遇到flex 报错。一直过不了。后来发现安装flex bison两个包后解决sudo apt-get install flex bison...

荔枝派Nano 全流程指南

荔枝派Nano 全流程指南

u-boot 初体验安装交叉编译链首先需要安装交叉编译链:# 此处为获取7.2.1版本,您可获取其他版本或者通过链接直接下载 wget http://releases.linaro.org/components/toolchain/binaries/7.2-2017.11/arm-linux-gnueabi/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi.tar.xz tar -vxJf gcc-li...

发表评论

访客

看不清,换一张

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