龙芯技术社区
直播中

gjianw217

10年用户 687经验值
擅长:嵌入式技术 控制/MCU RF/无线
私信 关注
[2K系列]

【龙芯2K0300蜂鸟板试用】3 体验四大操作系统(Buildroot、Loongnix、Openharmony、OpenWRT)

总结

1 openwrt和buildroot的镜像烧录成功
2 openharmony烧录成功,启动卡住,测试失败
3 loongnix镜像结构与上面3种不同,测试失败

4 个人感觉,官方不是很重视这次试用,提出的问题,只是草草的回答一下,感觉过 过场,生态建设任重道远
5 我相信,2k0300是支持4种文件系统,但不相信官方提供的镜像,它们都在2k0300上做过测试

文档

查看《广东龙芯2K0300蜂鸟快速使用指南-V1.0.240725》的1.5TF卡使用方法,可以看到,可将镜像安装到TF卡,官方提供了2种方法,即windows环境和linux环境,由于windows环境还需要安装7Z和UltraISO,故本文使用linux环境的方法烧录根文件系统到TF卡上。

$ sudo umount /dev/sdX
$ gunzip gunzip -S .img rootfs.img
$ sudo dd if=rootfs of=/dev/sdX

查看网盘《04-文件系统》目录,官方提供了4种文件系统(Buildroot、Loongnix、Openharmony、OpenWRT),且都有二进制和源码,极大地方便用户的使用和体验,但由于没有LCD,或者本测体验有少许遗憾。

在更新前,查看原始的uboot环境变量(启动按下c进入uboot控制界面)

=> printenv bootargs

bootargs=console=ttyS0,115200 root=/dev/mmcblk0 rw noinitrd
init=/linuxrc rootfstype=ext4 rootwait

=> printenv mtdparts

mtdparts=spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),64k(dtb)

=> printenv panel

panel=default

=> printenv ver

ver=U-Boot 2022.04-v2.1.0-00429-g33df0614 (Jun 17 2024 -
18:01:41 +0800)

=>

进入内核的信息:

[root@LS-GD ~]# cat /proc/cmdline

earlycon console=ttyS0,115200 root=/dev/mmcblk0 rw noinitrd
init=/linuxrc rootfstype=ext4 rootwait
mtdparts=spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),64k(dtb) fbcon=rotate:0 panel=default
fbcon=logo-pos:center fbcon=logo-count:1

[root@LS-GD ~]# ls -al /dev/mmc*

brw-rw---- 1 root disk 179,
0 Feb  2 23:29 /dev/mmcblk0

brw-rw---- 1 root disk 179,
8 Feb  2 23:29 /dev/mmcblk0boot0

brw-rw---- 1 root disk 179, 16 Feb  2 23:29 /dev/mmcblk0boot1

Openwrt:

简介:

OpenWRT是一个高度模块化、高度自动化的嵌入式Linux系统, 广泛应用于路由器的嵌入式操作系统,也用于用于工控设备、电话、小型机器人、智能家居、路由器以及VOIP设备等。

龙芯中科编译的是2022.03,官方当前开发最新版为2023.05

https://openwrt.org/

https://git.openwrt.org/

定位到《04-文件系统\OpenWRT\二进制》目录,可以看到rootfs.img镜像

烧录:

2k0300$ sudo umount /dev/sdb1

2k0300$ cp /mnt/hgfs/share/openwrt-rootfs.img ./rootfs.img

2k0300$ gunzip -S .img rootfs.img

ll rootfs

-rwxrwxr-x 1 xboard xboard 256000000  87 10:29 rootfs*

2k0300$ sudo dd if=rootfs of=/dev/sdb

500000+0 records in

500000+0 records out

256000000 bytes (256 MB, 244 MiB) copied, 213.698 s, 1.2
MB/s

启动:

=> printenv bootargs

bootargs=console=ttyS0,115200 root=/dev/mmcblk0 rw noinitrd
init=/linuxrc rootfstype=ext4 rootwait

=> setenv bootargs 'console=ttyS0,115200
root=/dev/mmcblk1p1 rw noinitrd init=/linuxrc rootfstype=ext4 rootwait'

=> saveenv

Saving Environment to SPIFlash... Erasing SPI
flash...Writing to SPI flash...done

OK

重启,可以正常进入系统

=> reboot

LoongArch Initializing ...

RAM(Cache AS RAM) Initializing ...

Lock Scache Done.

Copy spl code to locked scache...

Jump to board_init_f...

Enter board_init_f...


/   ___  __  \\

|    |  |
|  | |\\ | | __ [__  |  | |
|    |
| __ |  \\ |

|___ |__| |__| | \\|
|__] ___] |__| | \\|    \\  |__] |__/ /

============ddr4 init and training done!========

Trying to boot from BootSpace

U-boot start ...

Jump to board_init_f...

U-Boot 2022.04-v2.1.0-00429-g33df0614 (Jun 17 2024 -
18:01:41 +0800), Build: jenkins-u-boot-2022.04-2k300-mini-dp-19

CPU:   LA264

Speed: Cpu @ 997 MHz/ Mem @ 800 MHz/ Bus @ 200 MHz

Model: loongson-2k300

Board: LS2K300-MINI-DP

DRAM:  512 MiB

512 MiB

Jump to board_init_r....

Core:  35 devices, 19
uclasses, devicetree: board

SF: Detected gd25q80 with page size 256 Bytes, erase size 4
KiB, total 1 MiB

bdinfo is in spi-flash

MMC:   mmc_init: -110,
time 1910

emmc@0x16140000: 0 (eMMC), mmc@0x16148000: 1 (SD)

Loading Environment from SPIFlash... OK

frame buffer addr: 0x900000000dc00000

In:    serial

Out:   serial
vidconsole

Err:   serial
vidconsole

Net:   eth0:
ethernet@0x16020000

************************** Notice **************************

Press c to enter u-boot console, m to enter boot menu

---

Bus ehci@0x16080000: USB EHCI 1.00

Bus ohci@0x16088000: USB OHCI 1.0

Bus otg@0x16040000: dwc2_usb otg@0x16040000: Core Release:
2.93a

USB DWC2

scanning bus ehci@0x16080000 for devices... 1 USB Device(s)
found

scanning bus ohci@0x16088000 for devices... 1 USB Device(s)
found

scanning bus otg@0x16040000 for devices... 1 USB Device(s)
found

Autoboot in 0 seconds

--if mmc0 --fmt ext4 --sym /boot/uImage

--of ram --fmt  --sym

--extra 0x0

loading...

loaded&burning 8830259 bytes ...

load&burn 8830259 finished

 Booting kernel from Legacy Image at 9000000003000000 ...

Image Name:   Linux-5.10.0.lsgd-ga7f3115b8c73

Image Type:   LoongArch Linux Kernel Image (gzip
compressed)

Data Size:    8830195 Bytes = 8.4 MiB

Load Address:
00200000

Entry Point:  00e26be0

Verifying Checksum
... OK

Uncompressing
Kernel Image

Warning: invalid device tree. Used linux default dtb

512 MiB

[    0.000000] Linux
version 5.10.0.lsgd-ga7f3115b8c73 (loongson@loongson)
(loongarch64-linux-gnu-gcc (LoongArch GNU toolchain rc1.3-1 (20240425)) 8.3.0,
GNU ld (LoongArch GNU toolchain rc1.3-1 20240425) 2.31.1.20190122) #1 PREEMPT
Mon Jun 17 17:33:02 CST 2024
.....................................
...................................

BusyBox v1.35.0 (2023-04-27 20:28:15 UTC) built-in shell
(ash)

---

|       |.-----.-----.-----.|  |
|  |.----.|  |_

|   -
||  _  |  -__|     ||
|  |  ||
_||   _|

|_______||   __|_____|__|__||________||__|  |____|


|__| W I R E

L E S S   F R E E D O M



OpenWrt 22.03.5,
r20134-5f15225c1e

---

Rootfs Resizing...

Partition resizing...

resize2fs 1.46.5 (30-Dec-2021)

Filesystem at /d[
35.069497] EXT4-fs (mmcblk1p1): resizing filesystem from 248976 to
7576576 blocks

ev/mmcblk1p1 is mounted on /; on-line resizing required

old_desc_blocks = 2, new_desc_blocks = 58

[   37.920903] EXT4-fs
(mmcblk1p1): resized filesystem to 7576576

The filesystem on /dev/mmcblk1p1 is now 7576576 (1k) blocks
long.

=== WARNING! =====================================

There is no root password defined on this device!

Use the "passwd" command to set up a new password

in order to prevent unauthorized SSH logins.

---

root@OpenWrt:/# ls

bin         lib         mnt         root        usr

boot        lib64       overlay     sbin
var

dev
linuxrc     proc        sys         www

etc
lost+found  rom         tmp

root@OpenWrt:/# [
89.357952] stmmaceth 16020000.ethernet eth0: Link is Up - 1Gbps/Full -
flow control rx/tx

[   89.366323] br-lan:
port 1(eth0) entered blocking state

[   89.371589] br-lan:
port 1(eth0) entered forwarding state

[   89.379194] IPv6:
ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

root@OpenWrt:/# ls /dev

autofs
mtdblock2     random        tty35         ttyS14

bus
mtdblock3     rfkill        tty36         ttyS15

console
null          rtc0          tty37         ttyS2

dri
port          shm           tty38         ttyS3

fb0           ppp           snapshot      tty39         ttyS4

full
psaux         snd           tty4          ttyS5

gpiochip0
ptmx          spidev1.0     tty40         ttyS6

hwrng
ptp0          spidev2.0     tty41         ttyS7

i2c-0         pts           stderr        tty42         ttyS8

i2c-1
ptyp0         stdin         tty43         ttyS9

i2c-2
ptyp1         stdout        tty44         ttyp0

i2c-3
ptyp2         tty           tty45         ttyp1

iio:device0
ptyp3         tty0          tty46         ttyp2

input
ptyp4         tty1          tty47         ttyp3

kmsg
ptyp5         tty10         tty48         ttyp4

log
ptyp6         tty11         tty49         ttyp5

loop-control
ptyp7         tty12         tty5          ttyp6

loop0
ptyp8         tty13         tty50         ttyp7

loop1
ptyp9         tty14         tty51         ttyp8

loop2
ptypa         tty15         tty52         ttyp9

loop3
ptypb         tty16         tty53         ttypa

loop4
ptypc         tty17         tty54         ttypb

loop5
ptypd         tty18         tty55         ttypc

loop6
ptype         tty19         tty56         ttypd

loop7
ptypf         tty2          tty57         ttype

mem
ram0          tty20         tty58         ttypf

mmcblk0
ram1          tty21         tty59         urandom

mmcblk0boot0
ram10         tty22         tty6          usbmon0

mmcblk0boot1
ram11         tty23         tty60         usbmon1

mmcblk1
ram12         tty24         tty61         usbmon2

mmcblk1p1
ram13         tty25         tty62         usbmon3

mtd0
ram14         tty26         tty63         vcs

mtd0ro
ram15         tty27         tty7          vcs1

mtd1
ram2          tty28         tty8          vcsa

mtd1ro
ram3          tty29         tty9          vcsa1

mtd2
ram4          tty3          ttyS0         vcsu

mtd2ro        ram5          tty30         ttyS1         vcsu1

mtd3
ram6          tty31         ttyS10        vga_arbiter

mtd3ro
ram7          tty32         ttyS11        zero

mtdblock0
ram8          tty33         ttyS12

mtdblock1
ram9          tty34         ttyS13

root@OpenWrt:/# top

Mem: 67952K used, 316192K free, 272K shrd, 2864K buff,
25888K cached

CPU:   0% usr   0% sys
0% nic 100% idle   0% io   0% irq
0% sirq

Load average: 0.38 0.38 0.17 1/66 3197

PID  PPID USER
STAT   VSZ %VSZ %CPU COMMAND

338     1 root
S     6480   2%
0% /usr/sbin/uhttpd -f -h /www -r OpenWrt

1643     1 nobody
S     4928   1%
0% avahi-daemon: running [OpenWrt.local]

1591     1 root
S     4096   1%
0% /usr/bin/dbus-daemon --system --nofork

163     1 root
S     3888   1%
0% /bin/ash --login

3197   163 root
R     3776   1%
0% top

635     1 root
S     3456   1%
0% /sbin/rpcd -s /var/run/ubus/ubus.sock

1     0 root

S     3120   1%
0% /sbin/procd

978     1 root
S     3008   1%
0% /sbin/netifd

581     1 logd
S     2960   1%
0% /sbin/logd -S 64

1039     1 root
S     2816   1%
0% /usr/sbin/odhcpd

858     1 root
S     2672   1%
0% /usr/sbin/dropbear -F -P /var/run/drop

162     1 ubus
S     2544   1%
0% /sbin/ubusd

199     1 root
S     2224   1%
0% /sbin/urngd

78     2 root
IW<      0   0%
0% [kworker/0:2H-kb]

16     2 root
IW       0   0%
0% [kworker/0:1-eve]

5     2 root


IW       0
0%   0% [kworker/0:0-eve]

10     2 root
IW       0   0%
0% [rcu_preempt]

61     2 root
IW       0   0%
0% [kworker/0:3-rcu]
9     2 root

SW       0   0%
0% [ksoftirqd/0]

6     2 root

IW<      0   0%
0% [kworker/0:0H-kb]

Openharmony:

简介:

鸿蒙中经常提及的OpenHarmony与HarmonyOS以及Harmony OS NEXT,这4者到底是什么关系呢?通过下图应该可以更直观的理解

《摘自https://baijiahao.baidu.com/s?id=1789115231956982514&wfr=spider&for=pc

中科编译的是openharmony4.1,官方当前开发最新版为5.0-beta

https://www.openharmony.cn/mainPlay

https://gitee.com/openharmony/docs/tree/master/zh-cn/release-notes

定位到《04-文件系统\OpenHarmony\ok4.1》目录,可以看到rootfs.img镜像

烧录:

经测试,官方提供的镜像,烧录后不能正常启动,官方,网盘openharmony的文件系统有问题(20240723),官方让升级uboot:
首先:想不了和uboot有什么关系?也没有说明
其次:即使后面升级了uboot,问题仍然存在

Loongnix:

简介:

中科编译的是2021.02,官方当前开发最新版为2024.05(从2013年开始,每3月发布一次(2,5,8,11))

基于Debian 10 的衍生版本。当前最新debian是12.6

烧录:

dd

if=Loongnix-Embedded-20.1.rc2-loongarch64-DVD-1.iso of=/dev/sdb bs=10M

如果要打印进度可以另开一个窗口输入: while killall -USR1 dd;

do sleep 5; done

启动:

启动无反应,询问官方官方,能否出一个使用loongnix的说明,提供了视频源,感觉很复杂,就没有试

其实我想,loongix是基于debian的,按道理可以做成buildroot类似的镜像,感觉光盘提供的,类buioldroot的镜像

https://www.debian.org/

Buildroot

简介:

Buildroot是Linux平台上一个开源的嵌入式Linux系统自动构建框架,由Makefile脚本和Kconfig配置文件构成的。

https://buildroot.org/

https://gitlab.com/buildroot.org/buildroot/

龙芯中科编译的是2021.02,官方当前开发最新版为2024.05(从2013年开始,每3月发布一次(2,5,8,11))

定位到《04-文件系统\Buildroot\二进制》目录,可以看到rootfs.img镜像,在full子目录下, 同样存在一个rootfs.img,从readme中可知,full下的根文件系统比较全,比较大小可知,fulll下的也比较全

烧录:

2k0300$ sudo umount /dev/sdb1

2k0300$ cp /mnt/hgfs/share/openwrt-rootfs.img ./rootfs.img

2k0300$ gunzip -S .img rootfs.img

ll rootfs

-rwxrwxr-x 1 xboard xboard 256000000 8月 7 10:29 rootfs*

启动:

可以正常启动

回帖(1)

zxq

2024-8-29 23:11:39
Openharmony,内核、固件都得升级了才行~
举报

更多回帖

发帖
×
20
完善资料,
赚取积分