源码目录: https://github.com/yuzibo/vf2-linux
使用 vf2 开头的分支,首先交叉编译出相应的 kernel riscv64 的 deb 包。 配置可以使用 debian_defconfig
或者你可以直接使用 prebuilt image download from here
sudo debootstrap --arch=riscv64 unstable /tmp/riscv64-chroot http://mirrors.tuna.tsinghua.edu.cn/debian/
sudo systemd-nspawn -D /tmp/riscv64-chroot/ -M debian --bind-ro=/etc/resolv.conf
apt update
apt upgrade
apt-get install initramfs-tools openssh-server systemd-timesyncd rsync bash-completion u-boot-menu
4.0 安装 kernel
这里有2种方式安装 kernel, 一种是自己构建,一种是使用 prebuild 第一种方式可以参考这里,第二种方式可以参考这里. 下面以 prebuilt 方式进行讲解:
# 1 download prebuild kernel image from here:
# https://github.com/yuzibo/vf2-linux *-dev branch with tag published
# then copy into /tmp/riscv64-chroot
~: ls
linux-headers-6.6.7-vf2_2023.12.14.08.37+88bd30f68_riscv64.deb
linux-image-6.6.7-vf2_2023.12.14.08.37+88bd30f68_riscv64.deb
apt install -f ./*.deb
4.0.1 u-boot
接下来需要配置与启动最直接相关的 u-boot 了:
主要一个是 /etc/default/u-boot,另一个是 uEnv.txt. 引导设备最好在dd 时再操作。
cat <<EOF >> /etc/default/u-boot
U_BOOT_PARAMETERS="rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0"
EOF
$ cat /etc/default/u-boot // double check
sed -i -e 's|root=[^ ]*|root=/dev/mmcblk1p3|' /boot/extlinux/extlinux.conf
Then
mkdir -p /boot/efi
配置 uEvn.txt
cat <<EOF > /boot/uEnv.txt
fdtdir=/boot/dtbs
fdtfile=starfive/jh7110-starfive-visionfive-2-v1.2a.dtb
kernel_comp_addr_r=0xb0000000
kernel_comp_size=0x10000000
EOF
change dtb file following your vf2 boards
最后:
cat <<EOF > /etc/fstab
/dev/mmcblk1p2 /boot/efi vfat umask=0077 0 1
EOF
4.1 配置 网络接口
cat <<EOF >> /etc/network/interfaces
allow-hotplug end0
iface end0 inet dhcp
EOF
echo vf2 > /etc/hostname
passwd # for vf2
# add new user
root@debian:/# adduser debian
info: Adding user `debian' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `debian' (1000) ...
info: Adding new user `debian' (1000) with group `debian (1000)' ...
info: Creating home directory `/home/debian' ...
info: Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for debian
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
info: Adding new user `debian' to supplemental / extra groups `users' ...
info: Adding user `debian' to group `users' ...
# passwd for debian is `debian`
passwd debian
New password:
Retype new password:
passwd: password updated successfully
usermod -aG sudo debian
作为应聘 Debian/RevyOS 实习生的一个硬性条件,需要完成以下目标:
下载 Debian hello 源代码, 修改其中的 src/hello.c 文件,然后重新打包并安装、运行
vimer@dev:~$ hello -h
Usage: hello [OPTION]...
Print a friendly, customizable greeting.
-h, --help display this help and exit
-v, --version display version information and exit
-t, --traditional use traditional greeting
-g, --greeting=TEXT use TEXT as the greeting message
hello, revyos
其中
hello, revyos 不是必须的,可出现自定义的 string 的即可。参考资料:
http://www.aftermath.cn/2022/02/17/sbuild-build-riscv-on-debian/ https://github.com/yuzibo/talks/blob/main/debian/2022-08-17-debian-fix-ftbfs-riscv64.pptx
说明,基于时效性,以上参考资料中的 URL 中带有 *debian-ports/可自动调整为 debian/.
使用了一段 dell r730, 感觉还是可以的,但是有些使用找不到 BMC 在哪里,故记录下。
只不过 r730 使用的是 iDRAC, 原理是差不多的。
https://blog.51cto.com/zhaodongwei/1855368, 详细的教程可以参考这篇。
根据教程,设置完网络后,接下来可以:
插入网线在服务器的左后面那个网络
网线的另一端可以直接插入的你的电脑/pc, 然后设置与刚才配置的网络一致的配置,打开浏览器,直接输入 server ip, 我的是 192.168.0.120, 然后直接定向到 管理界面。
然后就是 user及 passwd 了。
在我看来, cron 用法简洁,比一般的 systemd timer 要简单不少,所以,这里记录下我用 cron 时踩过的坑。
有2篇比较不多的文章:
我目前的环境是升级完系统后,需要在它的 /etc/crontab 修改为
SHELL=/bin/bash
基本上可以通过以上的文章了解到 cron 的一些基本用法,这里只是简单的记录我自己在使用过程的一些心得。
vimer@dev:~/check_log$ crontab -l
# 每6个小时的第15min执行一次
# https://www.cnblogs.com/kaituorensheng/p/4494321.html
15,30,45,59 * * * * /bin/bash /home/vimer/check_log/connect_test.sh > /tmp/test.txt 2>&1
其实主要的问题就是 SHELL 环境变量被修改了,直接编辑 /etc/crontab 就可以。
https://etherpad.openeuler.org/p/cron_summary
创建和使用应用专用密码
重要提示:若要创建应用专用密码,您需要为 Google 帐号开启两步验证。
如果您已开启两步验证,并且在登录帐号时收到了“密码不正确”错误消息,可以尝试使用应用专用密码。 前往您的 Google 帐号。
u-boot has their own dtb files (which they periodically sync with the linux tree, see f.e. here)