程序项目代做,有需求私信(小程序、网站、爬虫、电路板设计、驱动、应用程序开发、毕设疑难问题处理等)

龙芯2k0300 - 久久派开发环境搭建及内核升级(下)

在《龙芯2k0300 - 久久派开发环境搭建及内核升级(上)》我们对久久派开发板以及uboot、内核、文件系统的编译进行了介绍,本节主要介绍固件的升级,以及驱动移植。

一、更新固件

久久派开发板默认配套的是PMON固件以及linux 4.19的内核,这里我们打算将其替换换为uboot以及linux 6.12版本。

1.1 准备工作

1.1.1 串口连接

供电:久久派开发板集成了一个Type-C接口,用于给板子供电,板子上丝印标注DC-5V

串口:龙邱久久派扩展板上也有一个Type-C接口,其连接久久派UART0,电脑通过Type-C数据线可直接控制久久派,使用更方便。

注意:实际上如果通过串口连接,供电接口可以不用了,因为久久派和龙邱久久派扩展板5V是连通的,所以任意一个Type-C接口提供5V电源都可以。

我们将扩展板上的串口连接到电脑,然后打开电脑的MobaXterm,选择串口端口(我这里是COM4),设置波特率115200

1.1.2 测试

当我们按照前面的步骤接好线,给久久派复位上电,刚买的板子默认会输出如下信息:

点击查看详情
PMON2000 LOONGARCH Initializing. Standby...

lock scache 90000000 - 90040000
Lock Scache Done.
copy text section to lock cache done.
run in cache.
mem init done!
Copy Bios to memory OK, Uncompressing Bios..........OK, Booting Bios
unlock scache windows first
flush scache to unlock scache
unlock_base 0x9000000090000000
raw_memsz: 0x1
memorysize_high: 0x10000000
FREQ
RTC init done
cpu freq 1000000000, cnt 50000021
cpu freq 1000000000
DONE
set ebase done
DEVI
ENVI
MAPV
in envinit
nvram=1c000000
NVRAM is invalid!
NVRAM@1c000000
STDV
80100000:  memory between f800000-f800000  is already been allocated,heap is already above this point
SBDD
Icache 0x8000
Dcache 0x8000
L2 cache 0x100000
L3 cache 0x1
NETI
RTCL
in configure
mainbus0 (root)
localbus0 at mainbus0
emmc0 at localbus0syn0 at localbus0 phy device ID is: adb4,  phy vendor ID is: 412
==== Warning: unrecognized gmac phy!
in if attach
syn1 at localbus0 phy device ID is: 0,  phy vendor ID is: 0
==== Warning: unrecognized gmac phy!
in if attach
ohci0 at localbus0OHCI revision: 0x00000010
  RH: a: 0x02000901 b: 0x00000000
early period(0x0)
OHCI b01f800 initialized ok
drive at ohci0 devnum 1, Product OHCI Root Hub
 not configured
lotg0 at localbus0Halt all channels to put them into a known state

USB DWC2
drive at lotg0 devnum 2, Product U-Boot Root Hub
 not configured
loopdev0 at mainbus0out configure
begin dc_init
enter dc_init...
frame buffer addr: 7000000
pll found pstdiv[0x26], loopc[0x3e], frefc[0x4]
pll out[0x261f0408]
display controller reg config complete!
fbaddress = 9000000007000000
cfb_console init,fb=9000000007000000
CONSOLE_SIZE 1228800
devconfig done.
ifinit done.
domaininit done.
init_proc....
HSTI
SYMI
SBDE

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||  |||||||||       |||||       ||||   |||||  |||||      |||||       |||||       ||||   |||||  ||
||  ||||||||   ||||  |||   ||||  |||    ||||  ||||  ||||  |||   ||||  |||   ||||  |||    ||||  ||
||  ||||||||  |||||| |||  |||||| |||  |  |||  |||  ||||||||||||   |||||||  |||||| |||  |  |||  ||
||  ||||||||  |||||| |||  |||||| |||  ||  ||  |||  |||    |||||||    ||||  |||||| |||  ||  ||  ||
||  ||||||||  |||||| |||  |||||| |||  |||  |  |||  |||||  ||||||||||  |||  |||||| |||  |||  |  ||
||  ||||||||   ||||  |||   ||||  |||  ||||    |||   ||||  |||   |||  ||||   ||||  |||  ||||    ||
||       ||||       |||||       ||||  |||||   ||||       |||||      ||||||       ||||  |||||   ||
|||||||||||||||||||||||||||||||||||||||[2020 LOONGSON]|||||||||||||||||||||||||||||||||||||||||||

Configuration [loongson,EL,NET,IDE]
Version: PMON 5.0.3-Release (ls2k300) #2: Mon Jun  3 16:45:51 CST 2024 commit bc99ebfd9b4292970989b3a74070ad9897321272 Author: niupengju <niupengju@loongson.cn> Date:   Fri May 31 14:08:48 2024 +0800 .
Supported loaders [txt, srec, elf, bin]
Supported filesystems [tfcard, emmc, mtd, net, ext4, fat, fs, disk, iso9660, socket, tty, ram]
This software may be redistributed under the BSD copyright.
Copyright 2000-2002, Opsycon AB, Sweden.
Copyright 2005, ICT CAS.
CPU 3A5000 @ 1000.00 MHzMemory size 512 MB .
L1 Instruction cache size 32KB (128 Line, 4 Way)
L1 Data cache size 32KB (128 Line, 4 Way)
L2 cache size 1024KB
L3 cache size 0KB                                                                                                                                                         |BEV1
BEV in SR set to zero.
dtb chsum err! you should load_dtb before boot kernel!!! 




▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Ŀ
▒                 Boot Menu List                 ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Ĵ
▒ -> 1 'LoongOS (2k300)'                         ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒ Please Select Boot Menu [1]                    ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
Use the UP and DOWN keys to select the entry.
Press ENTER to boot selected OS.
Press 'c' to command-line.
                                                 Booting system in [0] second(s)
Now booting the 'LoongOS (2k300)'                                                                                                                                         /Loading file: (emmc0,0)/boot/vmlinuz (elf)                                                                                                                                -(elf)
0x9000000001410000/5966336 + 0x19c0a00/4202528(z) +
Entry address is 9000000001410000
Boot with parameters: console=tty console=ttyS0,115200 rdinit=/sbin/init rootdelay=5 root=/dev/mmcblk0p1
dtb chsum err!!!
[    0.000000] Linux version 4.19.190+ (loongson@loongson) (gcc version 8.3.0 (LoongArch GNU toolchain rc1.2 (20230615))) #3 SMP Mon Jun 3 10:20:57 CST 2024
[    0.000000] 64-bit Loongson Processor probed (LA264 Core)
[    0.000000] CPU0 revision is: 0014a030 (Loongson-64bit)
[    0.000000] FPU0 revision is: 00000001
[    0.000000] efi:
[    0.000000] DMI not present or invalid.
[    0.000000] The BIOS Version: (null)
[    0.000000] UEFI runtime services will not be available!
[    0.000000] software IO TLB: mapped [mem 0x014a0000-0x054a0000] (64MB)
[    0.000000] PM: Registered nosave memory: [mem 0x011c0000-0x011c3fff]
[    0.000000] Detected 1 available CPU(s)
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000200000-0x00000000ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000200000-0x000000000effffff]
[    0.000000]   node   0: [mem 0x0000000090000000-0x000000009fffffff]
[    0.000000] Zeroed struct page in unavailable ranges: 1152 pages
[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000009fffffff]
[    0.000000] percpu: Embedded 7 pages/cpu s62808 r8192 d43688 u114688
[    0.000000] CPU0 __my_cpu_offset: 4118000
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 31507
[    0.000000] Kernel command line: earlycon console=tty console=ttyS0,115200 rdinit=/sbin/init rootdelay=5 root=/dev/mmcblk0p1
[    0.000000] Dentry cache hash table entries: 65536 (order: 5, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 4, 262144 bytes)
[    0.000000] Memory: 386992K/505856K available (11820K kernel code, 1386K rwdata, 4288K rodata, 992K init, 570K bss, 118864K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 39093 entries in 39 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 4160, nr_irqs: 4160, preallocated irqs: 16
[    0.000000] timer_probe: no matching timers found
[    0.000000] Constant clock event device register
[    0.000000] clocksource: Constant: mask: 0xffffffffffffffff max_cycles: 0x3759f22983, max_idle_ns: 881590413697 ns
[    0.000005] sched_clock: 64 bits at 120MHz, resolution 8ns, wraps every 4398046511102ns
[    0.000009] Constant clock source device register
[    0.000140] Console: colour dummy device 80x25
[    0.000565] console [tty0] enabled
[    0.000638] Calibrating delay loop (skipped), value calculated using timer frequency.. 240.00 BogoMIPS (lpj=480000)
[    0.000679] pid_max: default: 32768 minimum: 301
[    0.000793] Security Framework initialized
[    0.000878] Mount-cache hash table entries: 2048 (order: 0, 16384 bytes)
[    0.000926] Mountpoint-cache hash table entries: 2048 (order: 0, 16384 bytes)
[    0.002398] Performance counters: loongarch/loongson64 PMU enabled, 4 64-bit counters available to each CPU.
[    0.002564] rcu: Hierarchical SRCU implementation.
[    0.003065] smp: Bringing up secondary CPUs ...
[    0.003089] smp: Brought up 1 node, 1 CPU
[    0.003748] devtmpfs: initialized
[    0.007927] random: get_random_u32 called from bucket_table_alloc.isra.9+0x94/0x1e0 with crng_init=0
[    0.008865] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.008919] futex hash table entries: 256 (order: 0, 16384 bytes)
[    0.009169] pinctrl core: initialized pinctrl subsystem
[    0.010176] NET: Registered protocol family 16
[    0.010933] audit: initializing netlink subsys (disabled)
[    0.011871] cpuidle: using governor menu
[    0.013252] audit: type=2000 audit(1577836800.008:1): state=initialized audit_enabled=0 res=1
[    0.021173] loongson pinctrl 16000490.pinctrl: 7 gpio chip add success, pins 112
[    0.022501] loongson pinctrl 16000490.pinctrl: loongson pinctrl probe success
[    0.083205] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.084590] ACPI: Interpreter disabled.
[    0.086341] vgaarb: loaded
[    0.086922] SCSI subsystem initialized
[    0.087944] usbcore: registered new interface driver usbfs
[    0.089380] usbcore: registered new interface driver hub
[    0.089496] usbcore: registered new device driver usb
[    0.090500] pps_core: LinuxPPS API ver. 1 registered
[    0.090531] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.090648] PTP clock support registered
[    0.094111] Advanced Linux Sound Architecture Driver Initialized.
[    0.095048] Bluetooth: Core ver 2.22
[    0.095128] NET: Registered protocol family 31
[    0.095148] Bluetooth: HCI device and connection manager initialized
[    0.095248] Bluetooth: HCI socket layer initialized
[    0.095273] Bluetooth: L2CAP socket layer initialized
[    0.095319] Bluetooth: SCO socket layer initialized
[    0.095942] clocksource: Switched to clocksource Constant
[    0.180045] pnp: PnP ACPI: disabled
[    0.199393] NET: Registered protocol family 2
[    0.200323] tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 16384 bytes)
[    0.200380] TCP established hash table entries: 4096 (order: 1, 32768 bytes)
[    0.200430] TCP bind hash table entries: 4096 (order: 2, 65536 bytes)
[    0.200520] TCP: Hash tables configured (established 4096 bind 4096)
[    0.200628] UDP hash table entries: 512 (order: 0, 16384 bytes)
[    0.200664] UDP-Lite hash table entries: 512 (order: 0, 16384 bytes)
[    0.200921] NET: Registered protocol family 1
[    0.201931] RPC: Registered named UNIX socket transport module.
[    0.201961] RPC: Registered udp transport module.
[    0.201981] RPC: Registered tcp transport module.
[    0.202000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.205739] Initialise system trusted keyrings
[    0.206638] workingset: timestamp_bits=62 max_order=15 bucket_order=0
[    0.225701] NFS: Registering the id_resolver key type
[    0.225776] Key type id_resolver registered
[    0.225797] Key type id_legacy registered
[    0.225826] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.225862] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.225895] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    0.227316] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.227864] SGI XFS with security attributes, no debug enabled
[    1.023911] random: fast init done
[    1.587976] Key type asymmetric registered
[    1.588027] Asymmetric key parser 'x509' registered
[    1.588153] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    1.588190] io scheduler noop registered
[    1.588385] io scheduler cfq registered (default)
[    1.588407] io scheduler mq-deadline registered
[    1.588427] io scheduler kyber registered
[    1.597067] Serial: 8250/16550 driver, 16 ports, IRQ sharing disabled
[    1.605376] console [ttyS0] disabled
[    1.605476] 16100000.serial: ttyS0 at MMIO 0x16100000 (irq = 16, base_baud = 6250000) is a Loongson 2k1500 16550
[    2.248935] console [ttyS0] enabled
[    2.253507] 16100400.serial: ttyS1 at MMIO 0x16100400 (irq = 17, base_baud = 6250000) is a Loongson 2k1500 16550
[    2.264877] 16100800.serial: ttyS2 at MMIO 0x16100800 (irq = 18, base_baud = 6250000) is a Loongson 2k1500 16550
[    2.276161] loongarch_iommu_ivrs_init get ivrs table failed
[    2.281806] Failed to init iommu by ivrs
[    2.288605] [drm] loongson kernel modesetting driver enable
[    2.295423] [drm] No OF Graph in dtb, fallback to legacy
[    2.301021] [drm] found 1 display timings for connector-0
[    2.306463] [drm] connector0 is DPI
[    2.310029] [drm] Total 1 outputs
[    2.313672] lsdc 16090000.dc: register irq(71) handler for ls7a2000
[    2.319979] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    2.326616] [drm] No driver support for vblank timestamp query.
[    2.333276] [drm] Initialized lsdc 1.1.1 20190831 for 16090000.dc on minor 0
[    2.386398] Console: switching to colour frame buffer device 128x37
[    2.409123] lsdc 16090000.dc: fb0: DRM emulated frame buffer device
[    2.431364] loop: module loaded
[    2.436665] ls-nand driver initializing
[    2.441621] ls-quadspi 16010000.spi0: unable to setup flash chip
[    2.448042] ls-quadspi: probe of 16010000.spi0 failed with error -1
[    2.456343] ls-spi-v1 1610c000.spi2: driver initialized
[    2.462582] libphy: Fixed MDIO Bus: probed
[    2.469950] CAN device driver interface
[    2.477324] lbx----->ctucan_platform_probe,76
[    2.485060] lscanfd 16110800.can: probe addr=ffffff81020d8800,irq=19 can_clk=100000000 ntxbufs=8 res->start=16110800
[    2.498762] lscanfd 16110800.can: lbx----device id :babe
[    2.508637] lbx----->ctucan_platform_probe,76
[    2.516493] lscanfd 16110c00.can: probe addr=ffffff81020e0c00,irq=20 can_clk=100000000 ntxbufs=8 res->start=16110c00
[    2.530183] lscanfd 16110c00.can: lbx----device id :babe
[    2.540629] stmmaceth 16020000.ethernet: no reset control found
[    2.550509] stmmaceth 16020000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[    2.560321] stmmaceth 16020000.ethernet:     DWMAC1000
[    2.568095] stmmaceth 16020000.ethernet: DMA HW capability register supported
[    2.578018] stmmaceth 16020000.ethernet: RX Checksum Offload Engine supported
[    2.587886] stmmaceth 16020000.ethernet: COE Type 2
[    2.595443] stmmaceth 16020000.ethernet: TX Checksum insertion supported
[    2.604824] stmmaceth 16020000.ethernet: Wake-Up On Lan supported
[    2.613843] stmmaceth 16020000.ethernet: Enhanced/Alternate descriptors
[    2.623214] stmmaceth 16020000.ethernet: Enabled extended descriptors
[    2.632318] stmmaceth 16020000.ethernet: Ring mode enabled
[    2.640384] stmmaceth 16020000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    2.658621] libphy: stmmac: probed
[    2.664724] mdio_bus stmmac-0:01: attached PHY driver [unbound] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
[    2.679279] dwc2 16040000.otg: 16040000.otg supply vusb_d not found, using dummy regulator
[    2.691323] dwc2 16040000.otg: Linked as a consumer to regulator.0
[    2.700492] dwc2 16040000.otg: 16040000.otg supply vusb_a not found, using dummy regulator
[    2.712124] dwc2 16040000.otg: Configuration mismatch. dr_mode forced to host
[    2.772143] dwc2 16040000.otg: dwc2_check_params: Invalid parameter lpm=1
[    2.781683] dwc2 16040000.otg: dwc2_check_params: Invalid parameter lpm_clock_gating=1
[    2.792310] dwc2 16040000.otg: dwc2_check_params: Invalid parameter besl=1
[    2.801859] dwc2 16040000.otg: dwc2_check_params: Invalid parameter hird_threshold_en=1
[    2.813286] dwc2 16040000.otg: DWC OTG Controller
[    2.821063] dwc2 16040000.otg: new USB bus registered, assigned bus number 1
[    2.831117] dwc2 16040000.otg: irq 48, io mem 0x16040000
[    2.840707] hub 1-0:1.0: USB hub found
[    2.847729] hub 1-0:1.0: 1 port detected
[    2.855743] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.864939] ehci-pci: EHCI PCI platform driver
[    2.872940] ehci-platform: EHCI generic platform driver
[    2.881717] ehci-platform 16080000.ehci: EHCI Host Controller
[    2.890209] ehci-platform 16080000.ehci: new USB bus registered, assigned bus number 2
[    2.901114] ehci-platform 16080000.ehci: irq 46, io mem 0x16080000
[    2.923957] ehci-platform 16080000.ehci: USB 2.0 started, EHCI 1.00
[    2.934152] hub 2-0:1.0: USB hub found
[    2.940850] hub 2-0:1.0: 1 port detected
[    2.948650] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    2.958327] ohci-platform: OHCI generic platform driver
[    2.966705] ohci-platform 16088000.ohci: Generic Platform OHCI controller
[    2.976246] ohci-platform 16088000.ohci: new USB bus registered, assigned bus number 3
[    2.987345] ohci-platform 16088000.ohci: irq 47, io mem 0x16088000
[    3.061163] hub 3-0:1.0: USB hub found
[    3.068125] hub 3-0:1.0: 1 port detected
[    3.076704] usbcore: registered new interface driver usb-storage
[    3.086621] udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers
[    3.099208] i8042: PNP: No PS/2 controller found.
[    3.106448] i8042: Probing ports directly.
[    3.113843] i8042: No controller found
[    3.121443] mousedev: PS/2 mouse device common for all mice
[    3.130511] Gt9xx driver installing..
[    3.139496] ls2x-rtc 16128000.rtc: rtc core: registered 16128000.rtc as rtc0
[    3.150505] i2c /dev entries driver
[    3.158742] goodix-ts 0-0014: GTP Driver Version: V2.8.0.2<2017/12/14>
[    3.168047] goodix-ts 0-0014: GTP I2C Address: 0x14
[    3.176585] goodix-ts 0-0014: Unset touchscreen-max-id, use default
[    3.185536] goodix-ts 0-0014: Unset touchscreen-size-x, use default
[    3.194372] goodix-ts 0-0014: Unset touchscreen-size-y, use default
[    3.203169] goodix-ts 0-0014: Unset touchscreen-max-w, use default
[    3.211876] goodix-ts 0-0014: Unset touchscreen-max-p, use default
[    3.220507] goodix-ts 0-0014: touch input parameters is [id x y w p]<16 600 1024 1024 1024>
[    3.231337] goodix-ts 0-0014: int-sync enabled
[    3.238255] goodix-ts 0-0014: auto-update enabled
[    3.245686] goodix-ts 0-0014: 0-0014 supply vdd_ana not found, using dummy regulator
[    3.256422] goodix-ts 0-0014: Linked as a consumer to regulator.0
[    3.265180] goodix-ts 0-0014: 0-0014 supply vcc_i2c not found, using dummy regulator
[    3.275816] goodix-ts 0-0014: No pinctrl found
[    3.282903] goodix-ts 0-0014: Success request irq-gpio
[    3.290569] goodix-ts 0-0014: Success request rst-gpio
[    3.298145] goodix-ts 0-0014: Guitar reset
[    3.403121] goodix-ts 0-0014: I2c read failed,dev:14,reg:8047,size:1
[    3.411885] goodix-ts 0-0014: GTP i2c test failed time 1
[    3.441819] goodix-ts 0-0014: I2c read failed,dev:14,reg:8047,size:1
[    3.450617] goodix-ts 0-0014: GTP i2c test failed time 2
[    3.480469] goodix-ts 0-0014: I2c read failed,dev:14,reg:8047,size:1
[    3.489206] goodix-ts 0-0014: GTP i2c test failed time 3
[    3.507858] goodix-ts 0-0014: Failed communicate with IC use I2C
[    3.516328] goodix-ts 0-0014: Regulator vcc_i2c disabled
[    3.523864] goodix-ts 0-0014: Regulator vdd_ana disabled
[    3.531735] goodix-ts: probe of 0-0014 failed with error -11
[    3.539761] ls-i2c 16108000.i2c: driver initialized
[    3.548514] ls-i2c 16109000.i2c: driver initialized
[    3.557986] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com
[    3.568707] Bluetooth: HCI UART driver ver 2.3
[    3.575373] Bluetooth: HCI UART protocol H4 registered
[    3.584655] ls2k_sdio 16140000.mmc0: Use exclusive dma engine.
[    4.019986] err: get cd, can't find gpio chip
[    4.027254] ls2k_sdio 16148000.sdio1: Use exclusive dma engine.
[    5.040287] usbcore: registered new interface driver usbhid
[    5.048193] usbhid: USB HID core driver
[    5.058599] soc-audio soc-audio: ASoC: machine LOONGSON-I2S should use snd_soc_register_card()
[    5.471466] err: get cd, can't find gpio chip
[    6.894015] mmc1: new high speed SDIO card at address 390b
[    7.118840] soc-audio soc-audio: ES8323.0-0010 <-> loongson-i2s-dai mapping ok
[    7.128796] soc-audio soc-audio: ASoC: DAPM unknown pin MicIn
[    7.142923] soc-audio soc-audio: ES8323.0-0010 <-> loongson-i2s-dai mapping ok
[    7.152838] soc-audio soc-audio: ASoC: no DMI vendor name!
[    7.164209] Initializing XFRM netlink socket
[    7.172879] NET: Registered protocol family 10
[    7.181778] Segment Routing with IPv6
[    7.188282] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    7.198303] NET: Registered protocol family 17
[    7.205910] NET: Registered protocol family 15
[    7.212868] can: controller area network core (rev 20170425 abi 9)
[    7.222019] NET: Registered protocol family 29
[    7.229246] can: raw protocol (rev 20170425)
[    7.236319] can: broadcast manager protocol (rev 20170425 t)
[    7.444828] can: netlink gateway (rev 20170425) max_hops=1
[    7.453855] Bluetooth: RFCOMM TTY layer initialized
[    7.461768] Bluetooth: RFCOMM socket layer initialized
[    7.469748] Bluetooth: RFCOMM ver 1.11
[    7.476214] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.484203] Bluetooth: BNEP filters: protocol multicast
[    7.492178] Bluetooth: BNEP socket layer initialized
[    7.499714] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    7.508246] Bluetooth: HIDP socket layer initialized
[    7.516477] Key type dns_resolver registered
[    7.524913] Loading compiled-in X.509 certificates
[    7.736624] mmc0: new HS200 MMC card at address 0001
[    7.745566] ls2x-rtc 16128000.rtc: setting system clock to 2000-01-01 00:08:44 UTC (946685324)
[    7.757751] mmcblk0: mmc0:0001 08A391 7.28 GiB
[    7.765957] mmcblk0boot0: mmc0:0001 08A391 partition 1 4.00 MiB
[    7.774610] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    7.785771] mmcblk0boot1: mmc0:0001 08A391 partition 2 4.00 MiB
[    7.800895]  mmcblk0: p1
[    7.957281] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    7.966724] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    7.977958] cfg80211: failed to load regulatory.db
[    7.985464] ALSA device list:
[    7.991099]   #0: LOONGSON-I2S
[    7.997402] Waiting 5 sec before mounting root device...
[   13.037973] EXT4-fs (mmcblk0p1): INFO: recovery required on readonly filesystem
[   13.047905] EXT4-fs (mmcblk0p1): write access will be enabled during recovery
[   13.065451] EXT4-fs (mmcblk0p1): recovery complete
[   13.073784] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[   13.084868] VFS: Mounted root (ext4 filesystem) readonly on device 179:1.
[   13.100161] devtmpfs: mounted
[   13.132257] Freeing unused kernel memory: 992K
[   13.139399] This architecture does not have kernel memory protection.
[   13.148602] Run /sbin/init as init process
[   13.292965] systemd[1]: System time before build time, advancing clock.
[   13.317252] systemd[1]: systemd 247 running in system mode. (+PAM +AUDIT -SELINUX +IMA -APPARMOR -SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ -LZ4 -ZSTD -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid)
[   13.345912] systemd[1]: Detected architecture loongarch64.

Welcome to LoongOS v0.1 (master)!

[   13.372645] systemd[1]: Set hostname to <LoongOS>.
[   13.541539] systemd-sysv-generator[988]: SysV service '/etc/init.d/psplash.sh' lacks a native systemd unit file. Automatically generating a unit file for compatibility. Please update package to include a native systemd unit file, in order to make it more safe and robust.
[   13.580208] systemd-sysv-generator[988]: SysV service '/etc/init.d/dropbear' lacks a native systemd unit file. Automatically generating a unit file for compatibility. Please update package to include a native systemd unit file, in order to make it more safe and robust.
[   13.892968] systemd[1]: Queued start job for default target Multi-User System.
[   13.906062] random: systemd: uninitialized urandom read (16 bytes read)
[   13.917950] systemd[1]: Created slice system-getty.slice.
[  OK  ] Created slice system-getty.slice.
[   13.944213] random: systemd: uninitialized urandom read (16 bytes read)
[   13.955768] systemd[1]: Created slice system-modprobe.slice.
[  OK  ] Created slice system-modprobe.slice.
[   13.980261] random: systemd: uninitialized urandom read (16 bytes read)
[   13.991815] systemd[1]: Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
[   14.020920] systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
[   14.048791] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Dispatch Password …ts to Console Directory Watch.
[   14.080667] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Started Forward Password R…uests to Wall Directory Watch.
[   14.108637] systemd[1]: Reached target Host and Network Name Lookups.
[  OK  ] Reached target Host and Network Name Lookups.
[   14.136351] systemd[1]: Reached target Paths.
[  OK  ] Reached target Paths.
[   14.160413] systemd[1]: Reached target Remote File Systems.
[  OK  ] Reached target Remote File Systems.
[   14.184385] systemd[1]: Reached target Slices.
[  OK  ] Reached target Slices.
[   14.208408] systemd[1]: Reached target Swap.
[  OK  ] Reached target Swap.
[   14.233489] systemd[1]: Listening on RPCbind Server Activation Socket.
[  OK  ] Listening on RPCbind Server Activation Socket.
[   14.260387] systemd[1]: Reached target RPC Port Mapper.
[  OK  ] Reached target RPC Port Mapper.
[   14.289869] systemd[1]: Listening on Syslog Socket.
[  OK  ] Listening on Syslog Socket.
[   14.312817] systemd[1]: Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[   14.341348] systemd[1]: Listening on Journal Audit Socket.
[  OK  ] Listening on Journal Audit Socket.
[   14.369027] systemd[1]: Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket (/dev/log).
[   14.397149] systemd[1]: Listening on Journal Socket.
[  OK  ] Listening on Journal Socket.
[   14.421315] systemd[1]: Listening on Network Service Netlink Socket.
[  OK  ] Listening on Network Service Netlink Socket.
[   14.449268] systemd[1]: Listening on udev Control Socket.
[  OK  ] Listening on udev Control Socket.
[   14.472931] systemd[1]: Listening on udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
[   14.497154] systemd[1]: Listening on User Database Manager Socket.
[  OK  ] Listening on User Database Manager Socket.
[   14.527169] systemd[1]: Mounting Huge Pages File System...
         Mounting Huge Pages File System...
[   14.551484] systemd[1]: Mounting POSIX Message Queue File System...
         Mounting POSIX Message Queue File System...
[   14.586795] systemd[1]: Mounting Kernel Debug File System...
         Mounting Kernel Debug File System...
[   14.618755] systemd[1]: Mounting Kernel Trace File System...
         Mounting Kernel Trace File System...
[   14.654547] systemd[1]: Mounting Temporary Directory (/tmp)...
         Mounting Temporary Directory (/tmp)...
[   14.685309] systemd[1]: Condition check resulted in Create list of static device nodes for the current kernel being skipped.
[   14.703004] systemd[1]: Starting Load Kernel Module configfs...
         Starting Load Kernel Module configfs...
[   14.731230] systemd[1]: Starting Load Kernel Module drm...
         Starting Load Kernel Module drm...
[   14.763024] systemd[1]: Starting Load Kernel Module fuse...
         Starting Load Kernel Module fuse...
[   14.795085] systemd[1]: Starting Start psplash boot splash screen...
         Starting Start psplash boot splash screen...
[   14.827060] systemd[1]: Starting RPC Bind...
         Starting RPC Bind...
[   14.863652] systemd[1]: Starting File System Check on Root Device...
         Starting File System Check on Root Device...
[   14.908759] systemd[1]: systemd-journald.service: unit configures an IP firewall, but the local system does not support BPF/cgroup firewalling.
[   14.941918] systemd[1]: (This warning is only shown for the first unit using IP firewalling.)
[   14.956480] systemd[1]: Starting Journal Service...
         Starting Journal Service...
[   14.981195] systemd[1]: Condition check resulted in Load Kernel Modules being skipped.
[   15.013528] systemd[1]: Mounting NFSD configuration filesystem...
         Mounting NFSD configuration filesystem...
[   15.058979] systemd[1]: Starting Apply Kernel Variables...
         Starting Apply Kernel Variables...
[   15.099211] systemd[1]: Starting Coldplug All udev Devices...
         Starting Coldplug All udev Devices...
[   15.161368] systemd[1]: Started Start psplash boot splash screen.
[  OK  ] Started Start psplash boot splash screen.
[   15.197743] systemd[1]: Started RPC Bind.
[   15.201950] audit: type=1130 audit(1616581519.900:2): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=psplash-start comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started RPC Bind.
[   15.245072] systemd[1]: Mounted Huge Pages File System.
[  OK  ] Mounted Huge Pages F[   15.260185] audit: type=1130 audit(1616581519.948:3): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rpcbind comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
ile System.
[   15.293308] systemd[1]: Mounted POSIX Message Queue File System.
[  OK  ] Mounted POSIX Message Queue File System.
[   15.333293] systemd[1]: Mounted Kernel Debug File System.
[  OK  ] Mounted Kernel Debug File System.
[   15.369254] systemd[1]: Mounted Kernel Trace File System.
[  OK  ] Mounted Kernel Trace File System.
[   15.397011] systemd[1]: Mounted Temporary Directory (/tmp).
[  OK  ] Mounted Temporary Directory (/tmp).
[   15.425619] systemd[1]: modprobe@configfs.service: Succeeded.
[   15.441010] systemd[1]: Finished Load Kernel Module configfs.
[  OK  ] Finished Load Kernel Module configfs.
[   15.469800] systemd[1]: modprobe@drm.service: Succeeded.
[   15.475363] audit: type=1130 audit(1616581520.172:4): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@configfs comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   15.501106] systemd[1]: Finished Load Kernel Module drm.
[  OK     15.513497] audit: type=1131 audit(1616581520.172:5): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@configfs comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
m] Finished Load Kernel Module drm.
[   15.549097] systemd[1]: Started Journal Service.
[   15.553842] audit: type=1130 audit(1616581520.252:6): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@drm comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK     15.573232] audit: type=1131 audit(1616581520.252:7): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@drm comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
m] Started Journal Service.
[   15.608314] audit: type=1130 audit(1616581520.308:8): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Finished Load Kernel Module fuse.
[  OK     15.646580] audit: type=1130 audit(1616581520.348:9): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@fuse comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
m] Finished    15.666977] audit: type=1131 audit(1616581520.348:10): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=modprobe@fuse comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
1;39mFile System Check on Root Device.
[  OK     15.701912] audit: type=1130 audit(1616581520.404:11): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-fsck-root comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
m] Mounted NFSD configuration filesystem.
[  OK  ] Finished Apply Kernel Variables.
         Mounting Kernel Configuration File System...
[  OK  ] Started Start psplash-syst…progress communication helper.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Kernel Configuration File System.
[   15.895183] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[  OK  ] Finished Remount Root and Kernel File Systems.
         Starting Flush Journal to Persistent Storage...
         Starting Create Static Device Nodes in /dev...
[   15.996449] systemd-journald[1005]: Received client request to flush runtime journal.
[  OK  ] Finished Flush Journal to Persistent Storage.
[  OK  ] Finished Create Static Device Nodes in /dev.
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /var/volatile...
         Starting Rule-based Manage…for Device Events and Files...
[  OK  ] Mounted /var/volatile.
         Starting Load/Save Random Seed...
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[  OK  ] Finished Coldplug All udev Devices.
[  OK  ] Started Rule-based Manager for Device Events and Files.
[  OK  ] Finished Create Volatile Files and Directories.
         Starting Network Time Synchronization...
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Finished Update UTMP about System Boot/Shutdown.
[  OK  ] Started Network Time Synchronization.
[  OK  ] Reached target Sound Card.
[  OK  ] Reached target Syste[   18.059977] random: crng init done
m Initialization[   18.064012] random: 7 urandom warning(s) missed due to ratelimiting
.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target System Time Set.
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Listening on dropbear.socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
[  OK  ] Started Kernel Logging Service.
[  OK  ] Started System Logging Service.
[  OK  ] Started D-Bus System Message Bus.
         Starting IPv6 Packet Filtering Framework...
         Starting IPv4 Packet Filtering Framework...
         Starting User Login Management...
[  OK  ] Finished Load/Save Random Seed.
[  OK  ] Finished IPv6 Packet Filtering Framework.
[  OK  ] Finished IPv4 Packet Filtering Framework.
[  OK  ] Reached target Network (Pre).
         Starting Connection service...
         Starting Network Service...
[  OK  ] Started User Login Management.
[  OK  ] Started Connection service.
[  OK  ] Started Network Service.
[  OK  ] Reached target Network.
[  OK     18.966472] Generic PHY stmmac-0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=stmmac-0:01, irq=POLL)
m] Started NFS status monitor for NFSv2/3 locking..
[   19.008056] stmmaceth 16020000.ethernet eth0: No Safety Features support found
[  OK  ] Started Respond to IPv6 Node Information Queries.
[   19.027351] stmmaceth 16020000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
         Starting /etc/rc.local Compatibility...
[   19.083113] stmmaceth 16020000.ethernet eth0: registered PTP clock
[  OK  ] Started Network Router Discovery Daemon.
[   19.135040] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
         Starting Permit User Sessions...
[   19.160159] aic8800_bsp: loading out-of-tree module taints kernel.
[   19.259503] aicbsp_init
[   19.262081] RELEASE_DATE:2024_0327_3561b08f
[   19.266390] aicbsp_resv_mem_init
[  OK  ] Finished Permit User Sessions.
         Starting Hostname Service...
[  OK  ] Started Hostname Service.
[   20.553690] kauditd_printk_skb: 24 callbacks suppressed
[   20.553697] audit: type=1130 audit(1616581525.256:36): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   20.586400] aicbsp: aicbsp_set_subsys, subsys: AIC_WIFI, state to: 1
[   20.592859] aicbsp: aicbsp_set_subsys, power state change to 1 dure to AIC_WIFI
[   20.600185] aicbsp: aicbsp_platform_power_on
[   20.638246] aicbsp: aicbsp_sdio_probe:1 vid:0xC8A1  did:0x0082
[   20.646567] aicbsp: aicbsp_sdio_probe:2 vid:0xC8A1  did:0x0182
[   20.652482] aicbsp: aicbsp_sdio_probe after replace:1
[   20.659740] AICWFDBG(LOGINFO)        aicwf_sdio_chipmatch USE AIC8800D80
[   20.666019] aicbsp: aicbsp_get_feature, set FEATURE_SDIO_CLOCK 150 MHz
[   20.672553] aicbsp: aicwf_sdio_reg_init
[   20.683016] AICWFDBG(LOGINFO)        aicbsp: aicbsp_driver_fw_init, chip rev: 7
[   20.689970] rwnx_load_firmware :firmware path = /vendor/etc/firmware/fw_patch_table_8800d80_u02.bin
[   20.705272] file md5:0c9bf9c9c10f7a90a22a4c35fa58c967
[   20.710540] rwnx_plat_bin_fw_upload_android
[   20.715742] rwnx_load_firmware :firmware path = /vendor/etc/firmware/fw_adid_8800d80_u02.bin
[   20.725399] file md5:f546881a81b960d89a672578eb45a809
[   20.748037] rwnx_plat_bin_fw_upload_android
[   20.752270] rwnx_load_firmware :firmware path = /vendor/etc/firmware/fw_patch_8800d80_u02.bin
[   20.763114] file md5:35d137b8a76daaeb4f5034df8e15bcde
[   21.172027] aicbt_patch_table_load bt btmode[3]:5
[   21.176933] aicbt_patch_table_load bt uart_baud[3]:115200
[   21.182527] aicbt_patch_table_load bt uart_flowctrl[3]:0
[   21.188017] aicbt_patch_table_load bt lpm_enable[3]:0
[   21.193245] aicbt_patch_table_load bt tx_pwr[3]:28463
[   21.328024] aicbsp: bt patch version: - Mar 07 2024 14:29:05 - git f94a3e4
[   21.335021] rwnx_plat_bin_fw_upload_android
[   21.340339] rwnx_load_firmware :firmware path = /vendor/etc/firmware/fmacfw_8800d80_u02.bin
[   21.363855] file md5:13e6f0e58aae342d260d8672ab61c31f
[   22.700031] rd_version_val=06090101
[   22.768262] aicbsp: aicbsp_get_feature, set FEATURE_SDIO_CLOCK 150 MHz
[   22.774822] aicsdio: aicwf_sdio_reg_init
[   22.786161] aicbsp: aicbsp_resv_mem_alloc_skb, alloc resv_mem_txdata succuss, id: 0, size: 98304
[   22.795508] aicbsp: aicbsp_get_feature, set FEATURE_SDIO_CLOCK 150 MHz
[   22.803507] AICWFDBG(LOGINFO)        aicwf_prealloc_txq_alloc size is diff will to be kzalloc
[   22.811661] aicbsp: sdio_err:<aicwf_sdio_bus_pwrctl,1380>: bus down
[*    [   22.819376] AICWFDBG(LOGINFO)  aicwf_prealloc_txq_alloc txq kzalloc successful
 ] A start job is running for /etc/rc.local Compatibility (8s / no limit)
[   22.844574] AICWFDBG(LOGERROR)       invalid cmd: lvl_adj_5g_chan_42
[   22.850455] AICWFDBG(LOGERROR)       invalid cmd: lvl_adj_5g_chan_58
[   22.856327] AICWFDBG(LOGERROR)       invalid cmd: lvl_adj_5g_chan_106
[   22.862264] AICWFDBG(LOGERROR)       invalid cmd: lvl_adj_5g_chan_122
[   22.868199] AICWFDBG(LOGERROR)       invalid cmd: lvl_adj_5g_chan_138
[**    ] A start job is running for /etc/rc.local Compatibility (9s / no limit)
[   23.520044] ieee80211 phy0: HT supp 1, VHT supp 1, HE supp 1
[   23.540873] ieee80211 phy0:
[   23.540873] *******************************************************
[   23.540873] ** CAUTION: USING PERMISSIVE CUSTOM REGULATORY RULES **
         Stopping Connection service...
         Starting Network Name Resolution...
[  OK  ] Stopped Connection service.
[   26.817156] audit: type=1131 audit(1616581531.520:37): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=connman comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Network Name Resolution.
[   26.997264] audit: type=1130 audit(1616581531.700:38): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-resolved comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started /etc/rc.local Compatibility.
[   29.710560] audit: type=1130 audit(1616581534.412:39): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rc-local comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Getty on tty1.
[   29.761766] audit: type=1130 audit(1616581534.460:40): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=getty@tty1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Serial Getty on ttyS0.
[  OK     29.804362] audit: type=1130 audit(1616581534.504:41): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=serial-getty@ttyS0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
m] Reached target Login Prompts.
[  OK  ] Reached target Multi-User System.
         Starting Update UTMP about System Runlevel Changes...
[   29.898042] audit: type=1129 audit(1616581534.600:42): pid=1854 uid=0 auid=4294967295 ses=4294967295 msg='old-level=N new-level=3 comm="systemd-update-utmp" exe="/usr/lib/systemd/systemd-update-utmp" hostname=? addr=? terminal=? res=success'
[  OK  ] Finished Update UTMP about System Runlevel Changes.
[   29.957677] audit: type=1130 audit(1616581534.652:43): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-update-utmp-runlevel comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   29.992600] audit: type=1131 audit(1616581534.652:44): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-update-utmp-runlevel comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

.--.
|  |
|  |        .------. .------.  .------.  .------.
|  |        |      | |      |  |      |  |      |
|  ------.  |      | |      |  |      |  '------|
'--------'  '------' '------'  '      '         |
                                          ------'

The LoongOS Distribution LoongOS ttyS0

LoongOS v0.1 - Kernel

LoongOS login: [   50.606131] audit: type=1131 audit(1616581555.308:45): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-hostnamed comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

1.2 刷写uboot

uboot烧写参考资料:

1.2.1 搭建tftp服务器

由于我们要通过PMON中更新PMON固件,首先需要在我们的ubuntu虚拟机搭建一个tftp服务器,具体可以参考《嵌入式Linux开发环境搭建》,这里我在/opt 目录下创建一个子目录tftpboot;

zhengyang@ubuntu:/opt$ sudo mkdir tftpboot
zhengyang@ubuntu:/opt$ sudo chmod 0777 tftpboot

并按照教程中进行搭建tftp服务器,我们需要将我们的固件u-boot-with-spl.bin放在这个目录下;

zhengyang@ubuntu:/opt$ cp /opt/2k0300/build-2k0300/workspace/u-boot/u-boot-with-spl.bin ./tftpboot/
1.2.2 进入PMON命令行

给久久派复位上电,疯狂按c进入进入PMON命令行模式;

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Ŀ
▒                 Boot Menu List                 ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒Ĵ
▒ -> 1 'LoongOS (2k300)'                         ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒                                                ▒
▒ Please Select Boot Menu [1]                    ▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
Use the UP and DOWN keys to select the entry.
Press ENTER to boot selected OS.
Press 'c' to command-line.
                                                 Booting system in [3] second(s)
PMON>

直到出现 PMON> 提示符,首先给开发板配置一个与tftp服务器同网段的IP地址:

PMON> ifaddr syn0 172.23.34.188
bootp=f00b740
synopGMAC_linux_open called
Version = 0x1137
MacAddr = 0x0   0x55    0x7b    0xb5    0x7d    0xf7

===phy HALFDUPLEX MODE
DMA status reg = 0x0 before cleared!
DMA status reg = 0x0 after cleared!
register poll interrupt: gmac 0
==arp_ifinit done

===phy FULLDUPLEX MODE
Link is with 1000M Speed

IP设置为172.23.34.188 ,这样开发板 (172.23.34.188) 和ubuntu虚拟机 (172.23.34.187) 就在同一个网段上,可以开始传文件刷机了;

PMON> ping 172.23.34.187
PING 172.23.34.187 (172.23.34.187): 56 data bytes
64 bytes from 172.23.34.187: icmp_seq=0 ttl=64 time=9.343 ms
64 bytes from 172.23.34.187: icmp_seq=1 ttl=64 time=1.292 ms
64 bytes from 172.23.34.187: icmp_seq=2 ttl=64 time=1.328 ms
64 bytes from 172.23.34.187: icmp_seq=3 ttl=64 time=1.724 ms

--- 172.23.34.187 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.292/3.410/9.343 ms
1.2.3 烧录

tftp服务器下载指定的固件文件(u-boot-with-spl.bin),并直接将其烧录到当前开发板的引导闪存SPI Nor Flash的起始位置:

PMON> fload tftp://172.23.34.187/u-boot-with-spl.bin
Loading file: tftp://172.23.34.187/u-boot-with-spl.bin dl_offset 900000000f800000 addr 900000000f800000
(bin)                                                                                                                                                                     |
Loaded 940877 bytes

Programming flash 900000000f800000:e5b4d into 800000001c000000
Erase end!                                                                                                                                                                -Programming end!
PMON>

此过程中,务必保持板卡通电,严禁断电。耐心等待加载及烧录完成,直至界面依次出现Erase end!Programming end!,且PMON命令行再次出现,即表示PMON烧录完成。

给久久派复位上电,等待终端出现大大的LOONGSON=>字样说明更新uboot固件成功;

LoongArch Initializing ...

RAM(Cache AS RAM) Initializing ...

Lock Scache Done.

Copy spl code to locked scache...

Jump to 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-g96038f5a (Mar 20 2026 - 16:36:39 +0800)

CPU:   LA264
Speed: Cpu @ 1000 MHz/ Mem @ 800 MHz/ Bus @ 200 MHz
Model: loongson-2k300
Board: LS2K300-99PI-WIFI
DRAM:  512 MiB
512 MiB

Jump to board_init_r....
Core:  36 devices, 20 uclasses, devicetree: board
WDT:   Not starting watchdog_d
SF: Detected xt25f08 with page size 256 Bytes, erase size 4 KiB, total 1 MiB
use the default bdinfo
bdinfo is default
MMC:   emmc@0x16140000: 0 (eMMC)
Loading Environment from SPIFlash... *** Warning - bad CRC, using default environment

frame buffer addr: 0x900000000dc00000
In:    serial
Out:   serial
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
init ls_trigger_boot and set it default value
init ls_trigger_u_kernel and set it default value
init ls_trigger_u_rootfs and set it default value
init ls_trigger_u_uboot and set it default value
init ls_trigger_ab_sys_status and set it default value
init ls_trigger_mac_sync and set it default value
Saving Environment to SPIFlash... Erasing SPI flash...Writing to SPI flash...done
OK
Autoboot in 0 seconds
SF: Detected xt25f08 with page size 256 Bytes, erase size 4 KiB, total 1 MiB
device 0 offset 0xf0000, size 0xd000
SF: 53248 bytes @ 0xf0000 Read: OK
Failed to load '/boot/uImage'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Bootcmd="setenv bootargs ${bootargs} root=/dev/mmcblk0p${syspart} mtdparts=${mtdparts} fbcon=rotate:${rotate} panel=${panel};sf probe;sf read ${fdt_addr} dtb;ext4load mmc 0:${syspart} ${loadaddr} /boot/uImage;bootm"
Boot Kernel failed. Kernel not found or bad.
=>

1.3 uboot测试

uboot启动后无法正确引导内核的,此时会进入uboot命令行模式,支持许多命令,有兴趣可以查看《Rockchip RK3399 - TPL/SPL方式加载uboot》。

1.3.1 查看板子信息

查看板子信息:

=> bdinfo
boot_params = 0x900000000cc12210
DRAM bank   = 0x0000000000000000
-> start    = 0x9000000000000000
-> size     = 0x0000000010000000
DRAM bank   = 0x0000000000000001
-> start    = 0x9000000090000000
-> size     = 0x0000000010000000
flashstart  = 0x0000000000000000
flashsize   = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate    = 115200 bps
relocaddr   = 0x900000000dc00000
reloc off   = 0x0000000000000000
Build       = 64-bit
current eth = ethernet@0x16020000
ethaddr     = d6:ec:6f:2f:22:c4
IP addr     = 192.168.1.20
fdt_blob    = 0x900000000ecc7600
new_fdt     = 0x900000000cbf9c10
fdt_size    = 0x00000000000021c0
Video       = dvo@0 active
FB base     = 0x900000000dc00000
FB size     = 1024x600x32
lmb_dump_all:
 memory.cnt  = 0x2
 memory[0]      [0x9000000000000000-0x900000000fffffff], 0x10000000 bytes flags: 0
 memory[1]      [0x9000000090000000-0x900000009fffffff], 0x10000000 bytes flags: 0
 reserved.cnt  = 0x2
 reserved[0]    [0x900000000cbf67c0-0x900000000ebfffff], 0x02009840 bytes flags: 0
 reserved[1]    [0x900000000f000000-0x900000000fffffff], 0x01000000 bytes flags: 4
devicetree  = board
1.3.2 查看环境变量

查看环境变量:

=> printenv
baudrate=115200
bootargs=console=ttyS0,115200 rw noinitrd init=/sbin/init rootfstype=ext4 rootwait
bootcmd=setenv bootargs ${bootargs} root=/dev/mmcblk0p${syspart} mtdparts=${mtdparts} fbcon=rotate:${rotate} panel=${panel};sf probe;sf read ${fdt_addr} dtb;ext4load mmc 0:${syspart} ${loadaddr} /boot/uImage;bootm
bootdelay=0
bootmenu_0=System boot select=updatemenu bootselect 1
bootmenu_1=Update kernel=updatemenu kernel 1
bootmenu_2=Update rootfs=updatemenu rootfs 1
bootmenu_3=Update u-boot=updatemenu uboot 1
bootmenu_4=Update dtb=updatemenu dtb 1
bootmenu_5=Update ALL=updatemenu all 1
bootmenu_6=System install or recover=updatemenu system 1
bootmenu_7=Video resolution select=updatemenu resolution 1
bootmenu_8=Video rotation select=updatemenu rotation 1
bootmenu_delay=10
eth1addr=2e:67:a7:f6:8a:89
ethaddr=d6:ec:6f:2f:22:c4
fdt_addr=0x900000000a000000
fdt_size=0xE000
fdtcontroladdr=900000000ecc7600
ipaddr=192.168.1.20
loadaddr=0x9000000003000000
ls_trigger_ab_sys_status=0
ls_trigger_boot=0
ls_trigger_mac_sync=0
ls_trigger_u_kernel=0
ls_trigger_u_rootfs=0
ls_trigger_u_uboot=0
menucmd=bootmenu
mtdids=nor0=spi0.0
mtdparts=spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),52k(dtb),4k(bdinfo_e),8k(ddr_context)
nand_pagesize=2048
netmask=255.255.255.0
panel=default
rd_size=0x2000000
rd_start=0x9000000007000000
rotate=0
serverip=192.168.1.2
splashimage=0x9000000003000000
splashpos=m,m
stderr=serial,vidconsole,vidconsole1
stdin=serial,,usbkbd
stdout=serial,vidconsole,vidconsole1
syspart=1
syspart_ch=0
syspart_last=4
ver=U-Boot 2022.04-g96038f5a (Mar 20 2026 - 16:36:39 +0800)

Environment size: 1587/16380 bytes

重点关注:

  • bootargs:启动参数为console=ttyS0,115200 rw noinitrd init=/sbin/init rootfstype=ext4 rootwait
  • bootcmd:启动命令为setenv bootargs ${bootargs} root=/dev/mmcblk0p${syspart} mtdparts=${mtdparts} fbcon=rotate:${rotate} panel=${panel};sf probe;sf read ${fdt_addr} dtb;ext4load mmc 0:${syspart} ${loadaddr} /boot/uImage;bootm,这个我们在前面已经介绍过;
  • syspart:系统分为1
  • fdt_addr:设备树加载地址为0x900000000a000000
  • loadaddr:内核加载地址为0x9000000003000000
  • mtdparts:板载的SPI Nor Flash分区信息为spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),52k(dtb),4k(bdinfo_e),8k(ddr_context)
1.3.3 mmc命令测试

在命令行输入mmc list命令用于来查看当前开发板一共有几个MMC设备:

=> mmc list
emmc@0x16140000: 0 (eMMC)

因为久久派只有一个eMMC,并且大小为8G,编号是 mmc 0,编号是mmc 0

需要查看eMMC信息,运行如下命令:

=> mmc info
Device: emmc@0x16140000
Manufacturer ID: d6
OEM: 3
Name: 08A391                    → 芯片型号
Bus Speed: 52000000             → 速率 52MHz 
Mode: MMC High Speed (52MHz)    → 高速模式
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 7.3 GiB
Bus Width: 8-bit               → 8位数据线(速度快)
Erase Group Size: 512 KiB
HC WP Group Size: 4 MiB
User Capacity: 7.3 GiB WRREL
Boot Capacity: 4 MiB ENH
RPMB Capacity: 4 MiB ENH
Boot area 0 is not write protected
Boot area 1 is not write protected

可以使用命令mmc part来查看其分区,比如查看eMMC的分区情况,输入如下命令:

=> mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     16              15269872        00000000-01     83

只有1个分区,整个Linux系统都在mmcblk0p1

1.3.4 sf

用于操作SPI Flash的命令集,支持探测、擦除、读写SPI NOR Flash芯片,是嵌入式开发中烧录固件、更新uboot、操作环境变量分区的核心工具;

子命令 语法 作用
probe sf probe 初始化 SPI 控制器并探测 Flash 芯片。在使用任何其他 sf 命令前必须先执行,以检测 Flash 是否存在并获取其大小、型号等信息。
read sf read <内存地址> <Flash偏移> <长度> 将 Flash 中指定偏移和长度的数据读入内存指定地址。
write sf write <内存地址> <Flash偏移> <长度> 将内存中的数据写入 Flash 指定偏移(必须先擦除)。
erase sf erase <Flash偏移> <长度> 擦除 Flash 指定区域(以扇区为单位)。擦除后区域变为 0xFF。
update sf update <内存地址> <Flash偏移> <长度> 比较内存和 Flash 内容,仅更新不同的部分(节省时间)。常用于升级固件。
test sf test <Flash偏移> <长度> 对 Flash 区域进行读写测试,用于验证硬件是否正常。

初始化SPI初始化SPI控制器并探测Flash芯片控制器并探测Flash芯片

=> sf probe
SF: Detected xt25f08 with page size 256 Bytes, erase size 4 KiB, total 1 MiB

在进行读、写、擦除时,如果已配置mtdparts,可以直接用分区名代替偏移和长度,比如:

=> sf read ${fdt_addr} dtb          # 从 dtb 分区读取设备树
1.3.5 mtdparts

mtdparts 是用于管理MTD分区表的命令。它可以为为SPI Nor FlashNand FlashMTD设备定义逻辑分区,之后就可以用分区名来替代具体的偏移地址和长度,让操作更直观、更安全。

命令 说明
mtdparts 列出当前所有 MTD 设备及其分区
mtdparts default 恢复默认分区表(由 CONFIG_MTDPARTS_DEFAULT 定义)
mtdparts add <设备名> <分区列表> 动态添加或修改分区(例如 mtdparts add nor0 1m(data)
mtdparts del <设备名> 删除该设备的所有分区定义

参考文章:《linux驱动移植-Nand Flash ONFI标准和MTD子系统》。

列出当前所有MTD设备及其分区:

=> mtdparts

device nor0 <spi0.0>, # parts = 6
 #: name                size            offset          mask_flags
 0: uboot               0x000e7000      0x00000000      0
 1: uboot_env           0x00008000      0x000e7000      0
 2: bdinfo              0x00001000      0x000ef000      0
 3: dtb                 0x0000d000      0x000f0000      0
 4: bdinfo_e            0x00001000      0x000fd000      0
 5: ddr_context         0x00002000      0x000fe000      0

active partition: nor0,0 - (uboot) 0x000e7000 @ 0x00000000

defaults:
mtdids  : nor0=spi0.0
mtdparts: spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),52k(dtb),4k(bdinfo_e),8k(ddr_context)

可以查看到SPI Nor Flash的分区表;

  • nor0:: 这是SPI Nor Flash芯片;
  • spi0.0: 接在SPI 0总线上;
  • # parts = 6: 这个Flash被分成了6个分区。
1.3.6 设置ip

我们需要通过网线将宿主机和开发板连接到同一个路由器的网卡。接着设置久久派ip ,网关等,根据自己网段修改, 保证局域网内没有其他设备使用;

=> setenv ipaddr 172.23.34.188
=> setenv netmask 255.255.128.0
=> setenv gatewayip 172.23.0.1

设置网关,根据自己局域网设置;

=> setenv serverip 172.23.34.187

测试与ubuntu虚拟机是否连通;

=> ping 172.23.34.187
Speed: 1000, full duplex
Using ethernet@0x16020000 device
host 172.23.34.187 is alive

保存环境变量:

=> saveenv
Saving Environment to SPIFlash... Erasing SPI flash...Writing to SPI flash...done
OK

1.4 bootmenu烧录

此外我们可以看到支持bootmenu命令,通过这个命令我们也可以实现设备树、内核、根文件系统的烧录。

=> bootmenu

  *** U-Boot Boot Menu ***

     [1] System boot select
     [2] Update kernel
     [3] Update rootfs
     [4] Update u-boot
     [5] Update dtb
     [6] Update ALL
     [7] System install or recover
     [8] Video resolution select
     [9] Video rotation select
     [a] U-Boot console

当然了也可以参考《WwuSama/21届智能车走马观碑开源仓库》中介绍的挂载NFS文件系统,然后再进行烧录的方式,不过这里我们就使用bootmenu进行烧录。

我们需要将如下文件拷贝到U盘的update目录;

  • uboot文件u-boot-with-spl.bin拷贝到U盘的update目录;
  • 将设备树ls2k300_99pi_wifi.dtb修改为dtb.bin拷贝到U盘的update目录;
  • 将内核uImage.gz修改为uImage拷贝到U盘的update目录,注意这里不要直接使用编译出来的uImage文件(这是个超链接文件);
  • 将根文件系统rootfs.ext2.gz修改为rootfs.img拷贝到U盘的update目录,注意这里不要直接使用编译出来的rootfs.img文件(这是个超链接文件)。

我们在windows系统通过DiskGenius工具将U盘格式化为EXT4文件系统;

然后双击右侧的可移动磁盘(G),然后进入磁盘创建目录update,并将准备的文件拷贝进去;

接着将U盘插入久久派开发板上面那个USB接口上。在下面进行更新的过程中如果出现U盘无法被识别的问题,尝试开发板复位。

1.4.1 更新设备树

执行bootmenu命令;

=> bootmenu

  *** U-Boot Boot Menu ***

     [1] System boot select
     [2] Update kernel
     [3] Update rootfs
     [4] Update u-boot
     [5] Update dtb
     [6] Update ALL
     [7] System install or recover
     [8] Video resolution select
     [9] Video rotation select
     [a] U-Boot console


  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit

选择Update dtb

  *** U-Boot Boot Menu ***

     [1] Update DTB (dtb.bin) to spi flash (by usb)
     [2] Update DTB (dtb.bin) to spi flash (by mmc)
     [3] Update DTB (dtb.bin) to spi flash (by tftp)
     [4] Clean  DTB parts
     [5] Return


  Press UP/DOWN to move, ENTER to select

选择第一个:

resetting USB...
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... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
  Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra
            Type: Removable Hard Disk
            Capacity: 29327.3 MB = 28.6 GB (60062500 x 512)
update dtb.............
### cur test cmd : fatload usb 0:0 ${loadaddr} /update/dtb.bin
Can't set block device
### cur test cmd : ext4load usb 0:0 ${loadaddr} /update/dtb.bin
21862 bytes read in 6 ms (3.5 MiB/s)
SF: Detected xt25f08 with page size 256 Bytes, erase size 4 KiB, total 1 MiB
SF: 57344 bytes @ 0xf0000 Erased: OK
device 0 offset 0xf0000, size 0x5566
21862 bytes written, 0 bytes skipped in 0.284s, speed 78002 B/s

######################################################
### update target: dtb
### update way   : usb
### update result: success
######################################################

这里会将U/update/dtb.bin文件烧录到内核SPI Nor Flashdtb分区,核心命令:

# 尝试从 USB 设备 0 的整个设备(无分区表)中读取 FAT 文件系统上的 /update/dtb.bin。
fatload usb 0:0 ${loadaddr} /update/dtb.bin
# 尝试从 USB 设备 0 的整个设备中读取 ext4 文件系统上的 /update/dtb.bin
ext4load usb 0:0 ${loadaddr} /update/dtb.bin

dtb文件被成功读取后,Uboot将数据写入了SPI Nor Flashdtb分区(0xf0000 偏移),写入成功。

1.4.2 更新根文件系统

执行bootmenu命令;

=> bootmenu

  *** U-Boot Boot Menu ***

     [1] System boot select
     [2] Update kernel
     [3] Update rootfs
     [4] Update u-boot
     [5] Update dtb
     [6] Update ALL
     [7] System install or recover
     [8] Video resolution select
     [9] Video rotation select
     [a] U-Boot console


  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit

选择Update rootfs

  *** U-Boot Boot Menu ***

     [1] Update rootfs (rootfs.img) (by usb)
     [2] Update rootfs (rootfs.img) (by tftp)
     [3] Update rootfs (rootfs.img) (by mmc)
     [4] Return


  Press UP/DOWN to move, ENTER to select

选择第一个:

resetting USB...
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... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
--if usb0 --fmt ext4 --sym /update/rootfs.img
--of mmc0 --fmt  --sym
--extra 0x1
loading...
loaded&burning 157529897 bytes ...

536870912/536870912
        536870912 bytes, crc 0xe8c26bee
load&burn 157529897 finished

从日志大概可以看到从U盘(usb0ext4格式)加载了/update/rootfs.imgrootfs.ext2经过gz压缩的根文件系统镜像)文件,并将其写入了整个eMMC设备(mmc0)。

这里:我们必须先烧录根文件系统,才能烧录内核,因为内核是烧录到根文件系统/boot目录下的。

1.4.3 更新内核

执行bootmenu命令;

=> bootmenu

  *** U-Boot Boot Menu ***

     [1] System boot select
     [2] Update kernel
     [3] Update rootfs
     [4] Update u-boot
     [5] Update dtb
     [6] Update ALL
     [7] System install or recover
     [8] Video resolution select
     [9] Video rotation select
     [a] U-Boot console


  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit

选择Update rootfs

  *** U-Boot Boot Menu ***

     [1] Update kernel (uImage) (by usb)
     [2] Update kernel (uImage) (by mmc)
     [3] Update kernel (uImage) (by tftp)
     [4] Return


  Press UP/DOWN to move, ENTER to select

选择第一个:

resetting USB...
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... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
--if usb0 --fmt ext4 --sym /update/uImage
--of mmc0:1 --fmt ext4 --sym /boot/uImage
--extra 0x0
loading...
loaded&burning 10361144 bytes ...
File System is consistent
file found, deleting
update journal finished
File System is consistent
update journal finished
load&burn 10361144 finished
loading...

从日志大概可以看到从U盘(usb0ext4格式)加载了/update/uImage文件,并将其写入/boot/uImage

1.4.4 启动

uboot命令行输入boot命令;

点击查看详情
=> boot
SF: Detected xt25f08 with page size 256 Bytes, erase size 4 KiB, total 1 MiB
device 0 offset 0xf0000, size 0xd000
SF: 53248 bytes @ 0xf0000 Read: OK
10361144 bytes read in 232 ms (42.6 MiB/s)
## Booting kernel from Legacy Image at 9000000003000000 ...
   Image Name:   Linux-6.12.0.lsgd+
   Image Type:   LoongArch Linux Kernel Image (gzip compressed)
   Data Size:    10361080 Bytes = 9.9 MiB
   Load Address: 00200000
   Entry Point:  00f33000
   Verifying Checksum ... OK
   Uncompressing Kernel Image
512 MiB
[    0.000000] Linux version 6.12.0.lsgd+ (zhengyang@ubuntu) (loongarch64-linux-gnu-gcc.br_real (Buildroot -ga9f4f28a-dirty) 13.3.0, GNU ld (GNU Binutils) 2.42) #2 PREEMPT d9c34db49 Mon Mar 23 21:47:49 CST 2026
[    0.000000] Loongson-64bit Processor probed (LA264 Core)
[    0.000000] CPU0 revision is: 0014a030 (Loongson-64bit)
[    0.000000] FPU0 revision is: 00000000
[    0.000000] efi: EFI v2.9 by LoongSon
[    0.000000] efi: SMBIOS=0xfffe000 FDTPTR=0x900000000a000000
[    0.000000] convert legacy mem map to new mem map.
[    0.000000] bootloader memmap block 0 type : 1 start : 200000 size : ee00000
[    0.000000] bootloader memmap block 1 type : 2 start : f000000 size : 1000000
[    0.000000] bootloader memmap block 2 type : 1 start : 90000000 size : 10000000
[    0.000000] ACPI: OSL: System description tables not found
[    0.000000] earlycon: ns16550a0 at MMIO 0x0000000016100000 (options '115200n8')
[    0.000000] printk: legacy bootconsole [ns16550a0] enabled
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: OSL: System description tables not found
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009c000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] OF: reserved mem: 0x000000009c000000..0x000000009dffffff (32768 KiB) map reusable linux,cma
[    0.000000] SMBIOS 3.0 present.
[    0.000000] DMI: Loongson LS2K300/LS2K300-99PI-WIFI, BIOS 2022.04-g96038f5a-dirty 04/01/2022
[    0.000000] DMI: Memory slots populated: 0/0
[    0.000000] CpuClock = 0
[    0.000000] The BIOS Version: 2022.04-g96038f5a-dirty
[    0.000000] software IO TLB: area num 1.
[    0.000000] software IO TLB: mapped [mem 0x0000000001cf0000-0x0000000005cf0000] (64MB)
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000200000-0x00000000ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000200000-0x000000000effffff]
[    0.000000]   node   0: [mem 0x0000000090000000-0x000000009fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000009fffffff]
[    0.000000] On node 0, zone DMA32: 128 pages in unavailable ranges
[    0.000000] On node 0, zone DMA32: 33792 pages in unavailable ranges
[    0.000000] Kernel command line: earlycon fbcon=logo-pos:center fbcon=logo-count:1 console=ttyS0,115200 rw noinitrd init=/sbin/init rootfstype=ext4 rootwait root=/dev/mmcblk0p1 mtdparts=spi0.0:924k(uboot),32k(uboot_env),4k(bdinfo),52k(dtb),4k(bdinfo_e),8k(ddr_context) fbcon=rotate:0 panel=default bp_start=0x900000000f030400 board_name=LS2K300-99PI-WIFI
[    0.000000] Unknown kernel command line parameters "panel=default board_name=LS2K300-99PI-WIFI", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 65536 (order: 5, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 4, 262144 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 31616
[    0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] RCU Tasks: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=1.
[    0.000000] RCU Tasks Trace: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=1.
[    0.000000] NR_IRQS: 2368, nr_irqs: 64, preallocated irqs: 16
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] Constant clock event device register
[    0.000000] clocksource: Constant: mask: 0xffffffffffffffff max_cycles: 0x3759f22983, max_idle_ns: 881590413697 ns
[    0.000000] sched_clock: 64 bits at 120MHz, resolution 8ns, wraps every 4398046511102ns
[    0.008086] Constant clock source device register
[    0.013245] Console: colour dummy device 80x25
[    0.017831] Calibrating delay loop (skipped), value calculated using timer frequency.. 240.00 BogoMIPS (lpj=120000)
[    0.028394] pid_max: default: 32768 minimum: 301
[    0.039524] LSM: initializing lsm=capability,yama
[    0.044332] Yama: becoming mindful.
[    0.050711] Mount-cache hash table entries: 2048 (order: 0, 16384 bytes, linear)
[    0.058207] Mountpoint-cache hash table entries: 2048 (order: 0, 16384 bytes, linear)
[    0.083373] rcu: Hierarchical SRCU implementation.
[    0.088257] rcu:     Max phase no-delay instances is 400.
[    0.094535] Memory: 343248K/505856K available (13440K kernel code, 8160K rwdata, 4272K rodata, 576K init, 1007K bss, 127856K reserved, 32768K cma-reserved)
[    0.110964] devtmpfs: initialized
[    0.118812] Performance counters: loongarch/loongson64 PMU enabled, 4 64-bit counters available to each CPU.
[    0.129453] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.139331] futex hash table entries: 256 (order: -2, 6144 bytes, linear)
[    0.161763] pinctrl core: initialized pinctrl subsystem
[    0.169626] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.176266] audit: initializing netlink subsys (disabled)
[    0.182094] audit: type=2000 audit(0.073:1): state=initialized audit_enabled=0 res=1
[    0.190573] thermal_sys: Registered thermal governor 'step_wise'
[    0.190700] Final SIMD width = 0
[    0.200231] ISA Bridge: /2k300-soc/isa@16400000
[    0.204862]  IO 0x0000000016400000..0x0000000016403fff  ->  0x0000000000000000
[    0.212337] hw-breakpoint: Found 4 breakpoint and 2 watchpoint registers.
[    0.231074] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.237962] HugeTLB: 112 KiB vmemmap can be freed for a 32.0 MiB page
[    0.250287] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.263644] gpio-lsirq 16104000.gpio: register irqnum=107, vhwirq-base=128, rirq-base=28
[    0.272463] ACPI: Interpreter disabled.
[    0.277722] loongson-lsia-dma 1612c000.dma: DMA driver registered
[    0.284407] SCSI subsystem initialized
[    0.288729] usbcore: registered new interface driver usbfs
[    0.294337] usbcore: registered new interface driver hub
[    0.299764] usbcore: registered new device driver usb
[    0.305052] mc: Linux media interface: v0.10
[    0.309423] videodev: Linux video capture interface: v2.00
[    0.315032] pps_core: LinuxPPS API ver. 1 registered
[    0.320053] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.329304] PTP clock support registered
[    0.333576] Advanced Linux Sound Architecture Driver Initialized.
[    0.340854] clocksource: Switched to clocksource Constant
[    0.347769] VFS: Disk quotas dquot_6.6.0
[    0.351793] VFS: Dquot-cache hash table entries: 2048 (order 0, 16384 bytes)
[    0.359507] pnp: PnP ACPI: disabled
[    0.373439] NET: Registered PF_INET protocol family
[    0.378735] IP idents hash table entries: 8192 (order: 2, 65536 bytes, linear)
[    0.394842] tcp_listen_portaddr_hash hash table entries: 2048 (order: 0, 16384 bytes, linear)
[    0.403529] Table-perturb hash table entries: 65536 (order: 4, 262144 bytes, linear)
[    0.411377] TCP established hash table entries: 4096 (order: 1, 32768 bytes, linear)
[    0.419231] TCP bind hash table entries: 4096 (order: 2, 65536 bytes, linear)
[    0.426490] TCP: Hash tables configured (established 4096 bind 4096)
[    0.434082] MPTCP token hash table entries: 1024 (order: 0, 24576 bytes, linear)
[    0.441701] UDP hash table entries: 512 (order: 0, 16384 bytes, linear)
[    0.448422] UDP-Lite hash table entries: 512 (order: 0, 16384 bytes, linear)
[    0.456639] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.463354] RPC: Registered named UNIX socket transport module.
[    0.469365] RPC: Registered udp transport module.
[    0.474123] RPC: Registered tcp transport module.
[    0.478877] RPC: Registered tcp-with-tls transport module.
[    0.484421] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.490941] NET: Registered PF_XDP protocol family
[    0.495803] PCI: CLS 0 bytes, default 64
[    0.501947] Initialise system trusted keyrings
[    0.506667] workingset: timestamp_bits=46 max_order=15 bucket_order=0
[    0.513237] zbud: loaded
[    0.554391] NFS: Registering the id_resolver key type
[    0.559543] Key type id_resolver registered
[    0.563775] Key type id_legacy registered
[    0.567961] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.574741] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.582248] ntfs3: Warning: Activated 64 bits per cluster. Windows does not support this
[    0.590427] ntfs3: Read-only LZX/Xpress compression included
[    0.692038] Key type asymmetric registered
[    0.696201] Asymmetric key parser 'x509' registered
[    0.707751] io scheduler mq-deadline registered
[    0.712408] io scheduler kyber registered
[    0.716993] io scheduler bfq registered
[    0.730007] pinctrl-single 16000490.pinmux: 128 pins, size 32
[    0.743054] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.754809] printk: legacy console [ttyS0] disabled
[    0.760276] 16100000.serial: ttyS0 at MMIO 0x16100000 (irq = 19, base_baud = 12500000) is a 16550A
[    0.769459] printk: legacy console [ttyS0] enabled
[    0.769459] printk: legacy console [ttyS0] enabled
[    0.779127] printk: legacy bootconsole [ns16550a0] disabled
[    0.779127] printk: legacy bootconsole [ns16550a0] disabled
[    0.793067] 16100400.serial: ttyS1 at MMIO 0x16100400 (irq = 20, base_baud = 12500000) is a 16550A
[    0.803304] 16100800.serial: ttyS2 at MMIO 0x16100800 (irq = 143, base_baud = 12500000) is a 16550A
[    0.826716] brd: module loaded
[    0.836794] loop: module loaded
[    0.842614] CAN device driver interface
[    0.846826] lscanfd 16110800.can: Clock frequency from DT: 200000000
[    0.853401] lscanfd 16110800.can: lscanfd tx-gpio[73] HIGH
[    0.859044] lscanfd 16110800.can: lscanfd---->src_addr#16110898,src_addr_width#4 priv->rx_dma_buf=0x66b8000
[    0.869497] lscanfd 16110800.can: lscanfd stb-gpio not configured, may cause can network crash!
[    0.878606] lscanfd 16110c00.can: Clock frequency from DT: 200000000
[    0.885140] lscanfd 16110c00.can: lscanfd tx-gpio[75] HIGH
[    0.890762] lscanfd 16110c00.can: lscanfd---->src_addr#16110c98,src_addr_width#4 priv->rx_dma_buf=0x66bc000
[    0.901180] lscanfd 16110c00.can: lscanfd stb-gpio not configured, may cause can network crash!
[    0.910377] stmmaceth 16020000.ethernet: IRQ eth_wake_irq not found
[    0.916715] stmmaceth 16020000.ethernet: IRQ eth_lpi not found
[    0.922601] stmmaceth 16020000.ethernet: IRQ sfty not found
[    0.928307] stmmaceth 16020000.ethernet: Cannot get CSR clock
[    0.934096] stmmaceth 16020000.ethernet: PTP uses main clock
[    0.940128] stmmaceth 16020000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[    0.946964] stmmaceth 16020000.ethernet:     DWMAC1000
[    0.951871] stmmaceth 16020000.ethernet: DMA HW capability register supported
[    0.959043] stmmaceth 16020000.ethernet: RX Checksum Offload Engine supported
[    0.966212] stmmaceth 16020000.ethernet: COE Type 2
[    0.971116] stmmaceth 16020000.ethernet: TX Checksum insertion supported
[    0.977852] stmmaceth 16020000.ethernet: Wake-Up On Lan supported
[    0.983983] stmmaceth 16020000.ethernet: Enhanced/Alternate descriptors
[    0.990630] stmmaceth 16020000.ethernet: Enabled extended descriptors
[    0.997102] stmmaceth 16020000.ethernet: Ring mode enabled
[    1.002616] stmmaceth 16020000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.010313] stmmaceth 16020000.ethernet: device MAC address d6:ec:6f:2f:22:c4
[    1.020057] usbcore: registered new interface driver cdc_ether
[    1.026023] usbcore: registered new interface driver cdc_eem
[    1.031769] usbcore: registered new interface driver net1080
[    1.037506] usbcore: registered new interface driver cdc_subset
[    1.043490] usbcore: registered new interface driver zaurus
[    1.049125] usbcore: registered new interface driver cdc_ncm
[    1.055266] dwc2 16040000.otg: Configuration mismatch. dr_mode forced to host
[    1.112963] dwc2 16040000.otg: Loongson Fix Param: 0
[    1.118296] dwc2 16040000.otg: DWC OTG Controller
[    1.123055] dwc2 16040000.otg: new USB bus registered, assigned bus number 1
[    1.130168] dwc2 16040000.otg: irq 147, io mem 0x16040000
[    1.136407] hub 1-0:1.0: USB hub found
[    1.140256] hub 1-0:1.0: 1 port detected
[    1.145456] ehci-platform 16080000.ehci: EHCI Host Controller
[    1.151506] usbcore: registered new interface driver cdc_acm
[    1.157364] ohci-platform 16088000.ohci: Generic Platform OHCI controller
[    1.164264] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.172574] ehci-platform 16080000.ehci: new USB bus registered, assigned bus number 2
[    1.180688] ohci-platform 16088000.ohci: new USB bus registered, assigned bus number 3
[    1.189080] ehci-platform 16080000.ehci: irq 148, io mem 0x16080000
[    1.195482] usbcore: registered new interface driver uas
[    1.201001] ohci-platform 16088000.ohci: irq 149, io mem 0x16088000
[    1.207383] usbcore: registered new interface driver usb-storage
[    1.213436] ehci-platform 16080000.ehci: USB 2.0 started, EHCI 1.00
[    1.219953] usbcore: registered new interface driver option
[    1.226374] hub 2-0:1.0: USB hub found
[    1.230223] usbserial: USB Serial support registered for GSM modem (1-port)
[    1.237263] hub 2-0:1.0: 1 port detected
[    1.242132] mousedev: PS/2 mouse device common for all mice
[    1.249147] loongson-rtc 16128000.rtc: registered as rtc0
[    1.255243] loongson-rtc 16128000.rtc: setting system clock to 2000-01-01T10:17:22 UTC (946721842)
[    1.265428] i2c_dev: i2c /dev entries driver
[    1.274936] usbcore: registered new interface driver uvcvideo
[    1.281390] hub 3-0:1.0: USB hub found
[    1.285206] hub 3-0:1.0: 1 port detected
[    1.289178] Driver for 1-wire Dallas network protocol.
[    1.296768] ls2k_sdio 16140000.sdio: Use exclusive dma engine.
[    1.482872] usb 1-1: new high-speed USB device number 2 using dwc2
[    1.721217] usb-storage 1-1:1.0: USB Mass Storage device detected
[    1.728994] scsi host0: usb-storage 1-1:1.0
[    1.741186] ls2k_sdio 16148000.sdio: Use exclusive dma engine.
[    1.756101] ls2k_sdio 16148000.sdio: Got CD GPIO
[    2.583334] hid: raw HID events driver (C) Jiri Kosina
[    2.595006] usbcore: registered new interface driver usbhid
[    2.605856] usbhid: USB HID core driver
[    2.616039] ls2k300_adc 1611c000.adc: ADC Device registered successfully
[    2.631700] Initializing XFRM netlink socket
[    2.644605] NET: Registered PF_INET6 protocol family
[    2.658116] Segment Routing with IPv6
[    2.665922] In-situ OAM (IOAM) with IPv6
[    2.674028] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.686621] NET: Registered PF_PACKET protocol family
[    2.697867] NET: Registered PF_KEY protocol family
[    2.707863] can: controller area network core
[    2.716975] NET: Registered PF_CAN protocol family
[    2.725861] can: raw protocol
[    2.731864] can: broadcast manager protocol
[    2.740865] can: netlink gateway - max_hops=1
[    2.752563] NET: Registered PF_RDS protocol family
[    2.762918] Key type dns_resolver registered
[    2.796160] registered taskstats version 1
[    2.805030] Loading compiled-in X.509 certificates
[    2.879821] ls-spi 16010000.spi: controller is unqueued, this is deprecated
[    2.914166] 6 cmdlinepart partitions found on MTD device spi0.0
[    2.937858] Creating 6 MTD partitions on "spi0.0":
[    2.956904] scsi 0:0:0:0: Direct-Access     SanDisk  Ultra            1.00 PQ: 0 ANSI: 6
[    2.965868] 0x000000000000-0x0000000e7000 : "uboot"
[    2.983577] 0x0000000e7000-0x0000000ef000 : "uboot_env"
[    3.005877] sd 0:0:0:0: [sda] 60062500 512-byte logical blocks: (30.8 GB/28.6 GiB)
[    3.021566] 0x0000000ef000-0x0000000f0000 : "bdinfo"
[    3.042026] sd 0:0:0:0: [sda] Write Protect is off
[    3.052236] 0x0000000f0000-0x0000000fd000 : "dtb"
[    3.070998] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    3.090599] 0x0000000fd000-0x0000000fe000 : "bdinfo_e"
[    3.115138] 0x0000000fe000-0x000000100000 : "ddr_context"
[    3.149222] sd 0:0:0:0: [sda] Attached SCSI removable disk
[    3.162131] ls-spi 16018000.spi: controller is unqueued, this is deprecated
[    3.191687] ls-spi-io 1610c000.spi: controller is unqueued, this is deprecated
[    3.223650] clk: Disabling unused clocks
[    3.236886] ALSA device list:
[    3.248861]   No soundcards found.
[    3.262256] Waiting for root device /dev/mmcblk0p1...
[    5.972459] mmc0: new high speed MMC card at address 0001
[    5.978576] mmcblk0: mmc0:0001 08A391 7.28 GiB
[    5.985583]  mmcblk0: p1
[    5.988902] mmcblk0boot0: mmc0:0001 08A391 4.00 MiB
[    5.995365] mmcblk0boot1: mmc0:0001 08A391 4.00 MiB
[    6.084551] EXT4-fs (mmcblk0p1): mounted filesystem 77fabf5f-333f-4f1b-9c30-f01c7422efda r/w with ordered data mode. Quota mode: none.
[    6.096886] VFS: Mounted root (ext4 filesystem) on device 179:1.
[    6.103321] devtmpfs: mounted
[    6.107568] Freeing unused kernel image (initmem) memory: 576K
[    6.113513] This architecture does not have kernel memory protection.
[    6.120015] Run /sbin/init as init process
[    6.466135] systemd[1]: System time before build time, advancing clock.
[    6.566012] systemd[1]: systemd 256.4 running in system mode (+PAM -AUDIT -SELINUX -APPARMOR -IMA -SMACK -SECCOMP -GCRYPT -GNUTLS +OPENSSL -ACL +BLKID +CURL -ELFUTILS -FIDO2 -IDN2 -IDN -IPTC +KMOD -LIBCRYPTSETUP -LIBCRYPTSETUP_PLUGINS +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE -TPM2 +BZIP2 -LZ4 +XZ +ZLIB -ZSTD -BPF_FRAMEWORK +XKBCOMMON -UTMP -SYSVINIT -LIBARCHIVE)
[    6.598715] systemd[1]: Detected architecture loongarch64.

Welcome to Buildroot 2024.08!

[    6.622923] systemd[1]: Hostname set to <LS-GD>.
[    7.086170] systemd[1]: multi-user.target: Wants dependency dropin /usr/lib/systemd/system/multi-user.target.wants/boot_run_service is not a valid unit name, ignoring.
[    7.448312] systemd[1]: Queued start job for default target Multi-User System.
[    7.475102] systemd[1]: Created slice Slice /system/getty.
[  OK  ] Created slice Slice /system/getty.
[    7.491700] systemd[1]: Created slice Slice /system/modprobe.
[  OK  ] Created slice Slice /system/modprobe.
[    7.507738] systemd[1]: Created slice Slice /system/serial-getty.
[  OK  ] Created slice Slice /system/serial-getty.
[    7.523506] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[    7.542385] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[    7.559197] systemd[1]: Expecting device /dev/ttyS0...
         Expecting device /dev/ttyS0...
[    7.570227] systemd[1]: Reached target NFS client services.
[  OK  ] Reached target NFS client services.
[    7.583075] systemd[1]: Reached target Path Units.
[  OK  ] Reached target Path Units.
[    7.594060] systemd[1]: Reached target Preparation for Remote File Systems.
[  OK  ] Reached target Preparation for Remote File Systems.
[    7.610041] systemd[1]: Reached target Remote File Systems.
[  OK  ] Reached target Remote File Systems.
[    7.623079] systemd[1]: Reached target Slice Units.
[  OK  ] Reached target Slice Units.
[    7.634117] systemd[1]: Reached target Swaps.
[  OK  ] Reached target Swaps.
[    7.669218] systemd[1]: Listening on RPCbind Server Activation Socket.
[  OK  ] Listening on RPCbind Server Activation Socket.
[    7.685187] systemd[1]: Reached target RPC Port Mapper.
[  OK  ] Reached target RPC Port Mapper.
[    7.709606] systemd[1]: Listening on Credential Encryption/Decryption.
[  OK  ] Listening on Credential Encryption/Decryption.
[    7.726521] systemd[1]: Listening on Journal Audit Socket.
[  OK  ] Listening on Journal Audit Socket.
[    7.740909] systemd[1]: Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket (/dev/log).
[    7.754895] systemd[1]: Listening on Journal Sockets.
[  OK  ] Listening on Journal Sockets.
[    7.768091] systemd[1]: Listening on Network Service Netlink Socket.
[  OK  ] Listening on Network Service Netlink Socket.
[    7.782966] systemd[1]: Listening on udev Control Socket.
[  OK  ] Listening on udev Control Socket.
[    7.796659] systemd[1]: Listening on udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
[    7.823252] systemd[1]: Mounting Huge Pages File System...
         Mounting Huge Pages File System...
[    7.856306] systemd[1]: Mounting POSIX Message Queue File System...
         Mounting POSIX Message Queue File System...
[    7.900439] systemd[1]: Mounting NFSD configuration filesystem...
         Mounting NFSD configuration filesystem...
[    7.948332] systemd[1]: Mounting Kernel Debug File System...
         Mounting Kernel Debug File System...
[    7.971782] systemd[1]: Kernel Trace File System was skipped because of an unmet condition check (ConditionPathExists=/sys/kernel/tracing).
[    8.017462] systemd[1]: Mounting Temporary Directory /tmp...
         Mounting Temporary Directory /tmp...
[    8.037966] systemd[1]: Create List of Static Device Nodes was skipped because of an unmet condition check (ConditionFileNotEmpty=/lib/modules/6.12.0.lsgd+/modules.devname).
[    8.073921] systemd[1]: Starting loongson-resize...
         Starting loongson-resize...
[    8.108517] systemd[1]: Starting Load Kernel Module configfs...
         Starting Load Kernel Module configfs...
[    8.160973] systemd[1]: Starting Load Kernel Module efi_pstore...
         Starting Load Kernel Module efi_pstore...
[    8.217028] systemd[1]: Starting Load Kernel Module fuse...
         Starting Load Kernel Module fuse...
[    8.286809] systemd[1]: Starting Starts Psplash Boot screen...
         Starting Starts Psplash Boot screen...
[    8.350716] systemd[1]: Starting RPC Bind...
         Starting RPC Bind...
[    8.369833] systemd[1]: File System Check on Root Device was skipped because of an unmet condition check (ConditionPathIsReadWrite=!/).
[    8.391917] random: crng init done
[    8.412202] (rpcbind)[134]: rpcbind.service: Referenced but unset environment variable evaluates to an empty string: RPCBIND_OPTIONS
[    8.437984] systemd[1]: Starting Journal Service...
         Starting Journal Service...
[    8.487389] systemd[1]: Load Kernel Modules was skipped because no trigger condition checks were met.
[    8.519287] systemd[1]: Starting Generate network units from Kernel command line...
         Starting Generate network units from Kernel command line...
[    8.574585] systemd-journald[135]: Collecting audit messages is enabled.
[    8.586723] systemd[1]: Starting Remount Root and Kernel File Systems...
         Starting Remount Root and Kernel File Systems...
[    8.668532] systemd[1]: Starting Apply Kernel Variables...
         Starting Apply Kernel Variables...
[    8.762640] systemd[1]: Starting Create Static Device Nodes in /dev gracefully...
[    8.799970] EXT4-fs (mmcblk0p1): re-mounted 77fabf5f-333f-4f1b-9c30-f01c7422efda r/w. Quota mode: none.
         Starting Create Static Device Nodes in /dev gracefully...
[    8.879840] systemd[1]: Starting Load udev Rules from Credentials...
         Starting Load udev Rules from Credentials...
[    8.986698] systemd[1]: Starting Coldplug All udev Devices...
         Starting Coldplug All udev Devices...
[    9.137368] systemd[1]: Started Starts Psplash Boot screen.
[  OK  ] Started Starts Psplash Boot screen.
[    9.160146] systemd[1]: Started RPC Bind.
[  OK  ] Started RPC Bind.
[    9.174812] systemd[1]: Started Journal Service.
[  OK  ] Started Journal Service.
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted POSIX Message Queue File System.
[FAILED] Failed to mount NFSD configuration filesystem.
See 'systemctl status proc-fs-nfsd.mount' for details.
[DEPEND] Dependency failed for NFS Mount Daemon.
[DEPEND] Dependency failed for NFS server and services.
[  OK  ] Mounted Kernel Debug File System.
[  OK  ] Mounted Temporary Directory /tmp.
[  OK  ] Finished loongson-resize.
[  OK  ] Finished Load Kernel Module configfs.
[  OK  ] Finished Load Kernel Module efi_pstore.
[  OK  ] Finished Load Kernel Module fuse.
[  OK  ] Finished Generate network units from Kernel command line.
[  OK  ] Finished Remount Root and Kernel File Systems.
[  OK  ] Finished Apply Kernel Variables.
[  OK  ] Finished Load udev Rules from Credentials.
[  OK  ] Reached target Preparation for Network.
         Mounting Kernel Configuration File System...
[DEPEND] Dependency failed for Start psplas…temd progress communication helper.
         Starting Flush Journal to Persistent Storage...
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Finished Create Static Device Nodes in /dev gracefu[    9.756967] systemd-journald[135]: Received client request to flush runtime journal.
lly.
         Starting Create Static Device Nodes in /dev...
[    9.930177] systemd-journald[135]: /var/log/journal/73290f76f2754cf68b0288f191767faa/system.journal: Realtime clock jumped backwards relative to last journal entry, rotating.
[    9.980732] systemd-journald[135]: Rotating system journal.
[  OK  ] Finished Create Static Device Nodes in /dev.
[  OK  ] Reached target Preparation for Local File Systems.
[  OK  ] Reached target Local File Systems.
[   10.064105] audit: type=1334 audit(1721825382.597:2): prog-id=6 op=LOAD
[   10.085949] audit: type=1334 audit(1721825382.604:3): prog-id=7 op=LOAD
         Starting Rule-based Manager for Device Events and Files...
[  OK  ] Finished Flush Journal to Persistent Storage.
         Starting Create System Files and Directories...
[  OK  ] Finished Coldplug All udev Devices.
[  OK  ] Started Rule-based Manager for Device Events and Files.
[   10.868957] audit: type=1334 audit(1721825383.401:4): prog-id=8 op=LOAD
         Starting Network Configuration...
[  OK  ] Finished Create System Files and Directories.
[   11.280924] audit: type=1334 audit(1721825383.812:5): prog-id=9 op=LOAD
         Starting Network Name Resolution...
[  OK  ] Started Network Configuration.
         Starting Enable Persistent Storage in systemd-networkd...
         Starting Wait for Network to be Configured...
[  OK  ] Finished Enable Persistent Storage in systemd-networkd.
[  OK  ] Started Network Name Resolution.
[  OK  ] Reached target Host and Network Name Lookups.
[  OK  ] Reached target System Initialization.
[  OK  ] Started Discard unused filesystem blocks once a week.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target Timer Units.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Listening on OpenSSH Server Socket…temd-ssh-generator, AF_UNIX Local).
[  OK  ] Listening on Hostname Service Socket.
[  OK  ] Reached target Socket Units.
[  OK  ] Reached target Basic System.
         Starting Modem Manager...
         Starting run a update_system to check ab system status...
         Starting D-Bus System Message Bus...
[  OK  ] Started NFS FSID Daemon.
[  OK  ] Found device /dev/ttyS0.
[   13.650264] do_page_fault(): sending SIGSEGV to update_system for invalid read access from 0000000000000000
[   13.687880] era = 0000007ff36fa81c in libc.so.6[8e81c,7ff366c000+168000]
[   13.710910] ra  = 00000001200053a4 in update_system[53a4,120000000+10000]
[   13.734064] audit: type=1701 audit(1721825386.267:6): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=212 comm="update_system" exe="/usr/local/sys_config_tool/update_system" sig=11 res=1
[  OK  ] Started D-Bus System Message Bus.
[FAILED] Failed to start run a update_system to check ab system status.
See 'systemctl status ab_system_check_boot.service' for details.
         Starting Network Manager...
         Starting WPA supplicant...
[  OK  ] Started Modem Manager.
[  OK  ] Started WPA supplicant.
[   15.349545] audit: type=1334 audit(1721825387.882:7): prog-id=10 op=LOAD
[   15.377000] audit: type=1334 audit(1721825387.894:8): prog-id=11 op=LOAD
         Starting Hostname Service...
[   15.406479] audit: type=1334 audit(1721825387.894:9): prog-id=12 op=LOAD
[  OK  ] Started Hostname Service.
         Starting Network Manager Script Dispatcher Service...
[  OK  ] Started Network Manager Script Dispatcher Service.
[   16.927934] stmmaceth 16020000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   16.944924] stmmaceth 16020000.ethernet eth0: PHY [stmmac-0:01] driver [Generic PHY] (irq=POLL)
[   16.965709] stmmaceth 16020000.ethernet eth0: No Safety Features support found
[   16.981930] stmmaceth 16020000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   17.001301] stmmaceth 16020000.ethernet eth0: registered PTP clock
[   17.016297] stmmaceth 16020000.ethernet eth0: configuring for phy/rgmii-id link mode
[  OK  ] Started Network Manager.
[  OK  ] Reached target Network.
         Starting Network Manager Wait Online...
         Starting Statistics collection and monitoring daemon...
         Starting OpenSSH server daemon...
         Starting Permit User Sessions...
[  OK  ] Finished Permit User Sessions.
[  OK  ] Started OpenSSH server daemon.
[  OK  ] Started Statistics collection and monitoring daemon.
[  OK  ] Started Getty on tty0.
         Starting run a script(default:/root/boot_run.sh) after boot...
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started run a script(default:/root/boot_run.sh) after boot.
[   20.093655] stmmaceth 16020000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[  OK  ] Finished Network Manager Wait Online.
         Starting Virtual Console Setup...
[  OK  ] Finished Virtual Console Setup.

Welcome to Loongson-gd
LS-GD login: root (automatic login)

[root@LS-GD ~]#

1.5 系统设置

1.5.1 设置密码
[root@LS-GD ~]# passwd root
Changing password for root
New password:
Bad password: too weak
Retype password:
passwd: password for root changed by root

密码这里我直接设置为123456

1.5.2 网络设置

执行ifconfig命令查看支持的网络信息;

[root@LS-GD ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr D6:EC:6F:2F:22:C4
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a815:6e80:765f:a196/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:397 errors:0 dropped:393 overruns:0 frame:0
          TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:23844 (23.2 KiB)  TX bytes:3036 (2.9 KiB)
          Interrupt:146

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

根据自己的网络情况,配置网络IP和和子网掩码,如果你本来就是192.168.1.x网段,就不用修改了;

[root@LS-GD ~]# ifconfig eth0 172.23.34.188 netmask 255.255.128.0 

添加直连路由:

[root@LS-GD ~]# ip route add 172.23.0.0/17 dev eth0 proto kernel scope link src 172.23.34.188

注意:某些嵌入式Linux系统(尤其是使用旧版ifconfig工具或特定内核版本)中,仅仅设置IP和掩码并不总是会自动在路由表中生成一条完美的网段路由。

添加默认网关:

[root@LS-GD ~]# route add default gw 172.23.0.1 eth0 

验证路由表:

[root@LS-GD ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.23.0.1      0.0.0.0         UG    0      0        0 eth0
172.23.0.0      0.0.0.0         255.255.128.0   U     0      0        0 eth0

测试是否和ubuntu虚拟机连通:

[root@LS-GD ~]# ping 172.23.34.187
PING 172.23.34.187 (172.23.34.187): 56 data bytes
64 bytes from 172.23.34.187: seq=0 ttl=64 time=12.000 ms
64 bytes from 172.23.34.187: seq=1 ttl=64 time=1.027 ms
64 bytes from 172.23.34.187: seq=2 ttl=64 time=0.948 ms

--- 172.23.34.187 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.948/4.658/12.000 ms

修改 ip_setup.sh:

[root@LS-GD ~]# vi /opt/ls_system_config/shell/ls2k1000_dp/ip_setup/ip_setup.sh

在这个文件里找 192.168.1.10。 将其修改为你的新 IP:172.23.34.188。

# nmcli connection modify $1-connection ipv4.method manual ipv4.addresses "$2/24"
修改为
nmcli connection modify $1-connection ipv4.method manual ipv4.addresses "$2/17" ipv4.gateway "172.23.0.1"
1.5.3 SSH连接

这里我的开发板ip地址为172.23.34.188,我们通过MobaXterm工具远程链接开发板,输入账号及密码:root/123456

1.5.4 查看系统

接着查看操作系统信息:

[root@LS-GD ~]# uname -a
Linux LS-GD 6.12.0.lsgd+ #3 PREEMPT d9c34db49 Sat Mar 28 16:17:26 CST 2026 loongarch64 GNU/Linux

[root@LS-GD ~]# cat /etc/os-release
NAME=Buildroot
VERSION=-gec8f9da7
ID=buildroot
VERSION_ID=2024.08
PRETTY_NAME="Buildroot 2024.08"

[root@LS-GD ~]# ls -l /
total 23
lrwxrwxrwx   1 root root     7 Mar 22  2026 bin -> usr/bin
drwx------   2 root root  1024 Mar 19  2026 boot
drwxr-xr-x  14 root root  4280 Jul 24 20:49 dev
drwxr-xr-x  30 root root  2048 Jul 24  2024 etc
drwxr-xr-x   2 root root  1024 Mar 22  2026 home
lrwxrwxrwx   1 root root     7 Mar 22  2026 lib -> usr/lib
lrwxrwxrwx   1 root root     3 Mar 22  2026 lib64 -> lib
lrwxrwxrwx   1 root root    10 Mar 22  2026 linuxrc -> /sbin/init
drwx------   2 root root 12288 Mar 22  2026 lost+found
drwxr-xr-x   2 root root  1024 Mar 19  2026 media
drwxr-xr-x   2 root root  1024 Mar 19  2026 mnt
drwxr-xr-x   3 root root  1024 Mar 22  2026 opt
dr-xr-xr-x 139 root root     0 Jan  1  1970 proc
drwx------   8 root root  1024 Jul 24  2024 root
drwxr-xr-x  15 root root   420 Jul 24 20:51 run
lrwxrwxrwx   1 root root     8 Mar 22  2026 sbin -> usr/sbin
drwxr-xr-x   2 root root  1024 Mar 22  2026 srv
dr-xr-xr-x  12 root root     0 Jan  1  1970 sys
drwxrwxrwt   8 root root   180 Jul 24 20:50 tmp
drwxr-xr-x  11 root root  1024 Mar 22  2026 usr
drwxr-xr-x  10 root root  1024 Jul 24 20:49 var
1.5.5 查看设备

查看eMMC块设备文件:

[root@LS-GD ~]# ls /dev/mmc* -l
brw-rw---- 1 root disk 179,  0 Jul 24 20:49 /dev/mmcblk0
brw-rw---- 1 root disk 179,  8 Jul 24 20:49 /dev/mmcblk0boot0
brw-rw---- 1 root disk 179, 16 Jul 24 20:49 /dev/mmcblk0boot1
brw-rw---- 1 root disk 179,  1 Jul 24 20:49 /dev/mmcblk0p1

这里一共有4个块设备节点;其中:

  • /dev/mmcblk0:表示的是eMMC这个设备,其主设备号为179,次设备号为0
  • mmcblk0boot0mmcblk0boot1对应两个Boot Area Partition
  • /dev/mmcblk0p1eMMC主存储区域划分出的第1个逻辑分区。

查看所有的块设备:

[root@LS-GD ~]# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mtdblock0     31:0    0  924K  0 disk
mtdblock1     31:1    0   32K  0 disk
mtdblock2     31:2    0    4K  0 disk
mtdblock3     31:3    0   52K  0 disk
mtdblock4     31:4    0    4K  0 disk
mtdblock5     31:5    0    8K  0 disk
mmcblk0      179:0    0  7.3G  0 disk
`-mmcblk0p1  179:1    0  7.3G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk
mmcblk0boot1 179:16   0    4M  1 disk

其中mtdblockx使我们的SPI Nor Flsh设备划分出来的分区,分区表信息如下:

分区名 大小 起始偏移(累计) 用途说明
uboot 924 KB 0x00000 存放 uboot 镜像(包括SPL和主uboot合并后的二进制),只比我们编译出来的u-boot-with-spl.bin大一点点
uboot_env 32 KB 0xE7000 (924K) 存放 uboot 环境变量(默认参数、启动命令等)
bdinfo 4 KB 0xEF000 (956K) 可能用于存储板卡信息(Board Info),如序列号、硬件版本等
dtb 52 KB 0xF0000 (960K) 存放设备树二进制文件(Device Tree Blob)
bdinfo_e 4 KB 0xFD000 (1012K) 可能是 bdinfo 的备份或扩展
ddr_context 8 KB 0xFE000 (1016K) 存储 DDR 初始化训练参数(用于快速启动或恢复)

其中mtdblock3使我们的dtb分区,后面如果烧写设备树可以直接写入这个分区;

dd if=/tmp/new.dtb of=/dev/mtdblock3 bs=1

需要注意的是文件大小不要超过52KB,否则可能覆盖后续分区的数据。

1.5.6 opencv测试

接着可以按照《在龙芯板子上部署OpenCV》中的步骤测试opencv

二、驱动移植

在前面章节中我们介绍了如何将久久派默认带有的PMON固件以及内核linux 4.19升级为ubootlinux 6.12版本。当我们的板子执行了升级操作后,我们的系统环境已经搭建完成了,接下来的任务就是移植驱动程序和编写应用程序。其中涉及的模块有:

  • VL53L0X测距模块;
  • 1.8SPI TFT屏幕(驱动芯片ST7735);
  • MPU6050陀螺仪;

这里我们参考的资料主要来源以下两个仓库:

2.1 创建项目目录

/opt/2k0300目录下创建子目录loongson_2k300_lib

zhengyang@ubuntu:/opt/2k0300$ mkdir loongson_2k300_lib
zhengyang@ubuntu:/opt/2k0300$ cd loongson_2k300_lib

创建驱动子目录:

zhengyang@ubuntu:/opt/2k0300/loongson_2k300_lib$ mkdir driver

创建测试用例子目录:

zhengyang@ubuntu:/opt/2k0300/loongson_2k300_lib$ mkdir example

创建走马观碑项目子目录:

zhengyang@ubuntu:/opt/2k0300/loongson_2k300_lib$ mkdir car_project

2.2 拷贝驱动

这里我们将《WwuSama/21届智能车走马观碑开源仓库》开源的linux 6.9源码下载下来,需要注意的是仓库中已经将linux内核源码移除了,但是其QQ交流群依然提供了内核源码,这里我下载了linux-6.9-WuwuSama-99pi.tar.gz,其驱动位于drivers/wuwu_drivers/

zhengyang@ubuntu:/opt/2k0300/build-2k0300/workspace/linux-6.9-WuwuSama-99pi$ ll drivers/wuwu_drivers/
-rw-rw-r--   1 zhengyang zhengyang  7109 12月 17 16:42 imc20602.h
-rw-rw-r--   1 zhengyang zhengyang  4144 12月 17 16:42 wuwu_brushless.c
-rw-rw-r--   1 zhengyang zhengyang  3601 12月 17 16:42 wuwu_buzzer.c
-rw-rw-r--   1 zhengyang zhengyang  4134 12月 17 16:42 wuwu_fans.c
-rw-rw-r--   1 zhengyang zhengyang  9198 12月 17 16:42 wuwu_icm42688.c
-rw-rw-r--   1 zhengyang zhengyang  5306 12月 17 16:42 wuwu_icm42688.h
-rw-rw-r--   1 zhengyang zhengyang 11666 12月 17 16:42 wuwu_imc20602.c
-rw-rw-r--   1 zhengyang zhengyang 13770 12月 17 16:42 wuwu_motor.c
-rw-rw-r--   1 zhengyang zhengyang  1488 12月 17 16:42 wuwu_motor.h
-rw-rw-r--   1 zhengyang zhengyang  4416 12月 17 16:42 wuwu_servo.c
-rw-rw-r--   1 zhengyang zhengyang 30204 12月 17 16:42 wuwu_vl53l0x.c
-rw-rw-r--   1 zhengyang zhengyang   877 12月 17 16:42 wuwu_vl53l0x.h

我们将这些驱动拷贝到loongson_2k300_lib/driver目录,供我们参考使用;

zhengyang@ubuntu:/opt/2k0300/loongson_2k300_lib/driver$ cp /opt/2k0300/build-2k0300/workspace/linux-6.9-WuwuSama-99pi/drivers/wuwu_drivers/* ./

2.3 准备工作

先在内核源码目录执行如下命令,生成 Module.symvers

zhengyang@ubuntu:/opt/2k0300/build-2k0300/workspace/linux-6.12$ source ../set_env.sh && make loongson_2k300_defconfig V=1
# 生成Module.symvers的命令
zhengyang@ubuntu:/opt/2k0300/build-2k0300/workspace/linux-6.12$ source ../set_env.sh && make  modules_prepare -j$(nproc)
# 如果没有Module.symvers才需要执行下面这条指令
zhengyang@ubuntu:/opt/2k0300/build-2k0300/workspace/linux-6.12$ cp vmlinux.symvers Module.symvers

这一步会生成完整的 Module.symvers,其中记录了内核导出的所有符号信息,这个后面编译驱动需要使用到。

参考文章

[1] Rockchip RK3399 - NanoPC-T4开发板介绍

[2] Rockchip RK3588 - NanoPC-T6开发板介绍

[3] 龙邱科技 龙芯2k301核心板软件开源库

[4] 龙芯LS2K0300久久派上手体验

[5] Loongson-2K0300-99PAI(久久派资料,推荐)

[6] 三、龙芯智能车学习之路 – 内核编译篇

[7] open-loongarch(官方仓库)

[8] SeekFree/逐飞科技LS2K0300开源库

[9] WwuSama/21届智能车走马观碑开源仓库

[10] NCNN模型推理资料链接 提取码: tihd

[11] LS2K0300久久派_V1.1板卡使用手册v1.2_20240705.pdf

[12] 第一卷-pmon软件使用手册.pdf

[13] 第二卷-pinctrldts开发手册.pdf

[14] 第三卷-2k300内核开发手册.pdf

[15] 第四卷-文件系统开发手册.pdf

[16] 第五卷-qt相关解决方案.pdf

posted @ 2026-03-28 17:05  大奥特曼打小怪兽  阅读(28)  评论(0)    收藏  举报
如果有任何技术小问题,欢迎大家交流沟通,共同进步