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

Ubuntu 运行在 Milk-V Duo上

Watrt1年前 (2024-05-15)LINUX9860

设置

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

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

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

相关文章

mpalqyer 播放命令

mpalqyer 播放命令

mplayer -vo fbdev2 -vf scale=1366:768 film.avi /usr/bin/mplayer -x 800 -y 480 -zoom -framedrop aa.avi...

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

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

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

利用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...

发表评论

访客

看不清,换一张

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