想体验下龙芯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/#mv qemu-x86_64-to-loongarch64 qemu-loongarch64#mkdir root#tar -xvpf loongarch64-clfs-system-20210903.tar.bz2 -C root/
4.测试下
#cp qemu-loongarch64 /bin//bin/qemu-loongarch64 -L root/ root/bin/lsloongarch64-clfs-system-20210903.tar.bz2 qemu-loongarch64 root
5.注册binfmt
#echo ":qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/bin/qemu-loongarch64:" > /proc/sys/fs/binfmt_misc/register
6.启动
#cp /bin/qemu-loongarch64 root/bin/#chroot rootbash-5.1#
7.查看下LA64的CLFS OS
bash-5.1# uname -aLinux 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)
Copyright 2015-2022 东方健康网版权所有 备案号:沪ICP备2020036824号-8 联系邮箱:562 66 29@qq.com