前言
想体验下龙芯OS,但是又没有龙芯开发板或者龙芯实体机。手头上只有一个X64环境的Linux发行版,应该怎么做呢?
概括
其实非常简单,可以通过Chroot命令和Qemu在X64的指令集系统上模拟龙芯OS,然后虚拟出一个龙芯的系统,简单的体验下。具体如下:
1.首先下载一个CLFS的Lonngarch64 System。
#wget https://github.com/tangyanzhi/jianghupt/releases/download/loongarch64/loongarch64-clfs-system-20210903.tar.bz2
2.下载一个LA64的Qemu
#wget https://github.com/tangyanzhi/jianghupt/releases/download/loongarch64/qemu-x86_64-to-loongarch64
3.进行如下操作
#mkdir loongarch64
#cp loongarch64-clfs-system-20210903.tar.bz2 loongarch64/
#cp qemu-x86_64-to-loongarch64 loongarch64/
#cd loongarch64
#mv qemu-x86_64-to-loongarch64 qemu-loongarch64
#cd ..
#mkdir root
#tar -xvpf loongarch64-clfs-system-20210903.tar.bz2 -C root/
4.测试下
#cp qemu-loongarch64 /bin/
#/bin/qemu-loongarch64 -L root/ root/bin/ls
loongarch64-clfs-system-20210903.tar.bz2 qemu-loongarch64 root
5.注册binfmt
#echo ":qemu-loongarch64:M::x7fELFx02x01x01x00x00x00x00x00x00x00x00x00x02x00x02x01:xffxffxffxffxffxfexfex00xffxffxffxffxffxffxffxffxfexffxffxff:/bin/qemu-loongarch64:" > /proc/sys/fs/binfmt_misc/register
6.启动
#cp /bin/qemu-loongarch64 root/bin/
#chroot root
bash-5.1#
7.查看下LA64的CLFS OS
bash-5.1# uname -a
Linux tang-virtual-machine 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 loongarch64 GNU/Linux
可以看到它是loongarch64 GNU/Linux,在这个里面就像平常操作Linux一样。
结尾
以上是虚拟一个LA64的CLFS System。简单体验下。
作者:江湖评谈(wx公众号:jianghupt)
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net