@anglersking 可以参考armbian
evler 发布的帖子
-
F1C200s Tina3.5 怎么打开bootlogo功能
请教下,F1C200s的Tina3.5.1如何让uboot显示bootlogo.fex图片
- 尝试在
u-boot-2014-07/include/configs/sun3iw1p1_nor.h
头文件中打开了CONFIG_SUNXI_MODULE_DISPLAY
宏定义后编译会报错
- 看了下disp2没有SUN3I?
- 尝试在
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@cweib 你这是接触不良吧.. 换个USB或者换个串口以及杜邦线试下
-
MQ-Quad Armbian Kodi Audio BLE 测试记录
Armbian Kodi Audio BLE 测试记录
Armbain GitHub
感谢 sputnik 的贡献让我们能用上MQ-Quad的Armbian下拉并编译Armbian
# 克隆仓库 git clone -b v22.08 https://github.com/open-cores/mangguo-h616-armbian.git cd mangguo-h616-armbian # 编译桌面版 ./compile.sh BOARD=mangopimcore BRANCH=edge RELEASE=jammy BUILD_MINIMAL=no BUILD_DESKTOP=yes KERNEL_ONLY=no KERNEL_CONFIGURE=no DESKTOP_ENVIRONMENT=xfce DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base COMPRESS_OUTPUTIMAGE=sha,gpg,img # 编译终端版 ./compile.sh BOARD=mangopimcore BRANCH=edge RELEASE=jammy BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_ONLY=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img
Bluetooth Test
# 进入 bluetooth 终端 bluetoothctl # Open bluetooth console [bluetooth]# power on # Open bluetooth power [bluetooth]# scan on # Start scanning peripheral devices [bluetooth]# devices # Lists the scanned peripherals [bluetooth]# exit # Exit bluetooth console
HDMI Audio test
# 配置 HDMI 的 I2S 音频 amixer -c 1 set 'I2S1 Src Select' 'APBIF_TXDIF0' amixer -c 1 set 'I2S1OUT' on # 在正常使用音频之前,必须先运行-D hw:2,0命令。(每次启动只需要执行一次即可) aplay test.wav -D hw:2,0 # 开始播放音乐 aplay test.wav -D hw:1,0
Kodi 搭建
- 下载并解压此文件:私人云下载(速度快,随时关闭共享) 百度云下载,密钥:zht3
# 更新下源 apt update # 进入 kodi 目录 cd kodi # 安装 Kodi apt install ./kodi_19.4+dfsg1-2_arm64.deb ./kodi-bin_19.4+dfsg1-2_arm64.deb ./kodi-data_19.4+dfsg1-2_all.deb --reinstall # 进入 ffmpeg 目录 cd ffmpeg # 安装 ffmpeg apt install ./ffmpeg_4.4.1-3ubuntu9_arm64.deb ./libavcodec-dev_4.4.1-3ubuntu9_arm64.deb ./libavcodec58_4.4.1-3ubuntu9_arm64.deb ./libavdevice-dev_4.4.1-3ubuntu9_arm64.deb ./libavdevice58_4.4.1-3ubuntu9_arm64.deb ./libavfilter-dev_4.4.1-3ubuntu9_arm64.deb ./libavfilter7_4.4.1-3ubuntu9_arm64.deb ./libavformat-dev_4.4.1-3ubuntu9_arm64.deb ./libavformat58_4.4.1-3ubuntu9_arm64.deb ./libavutil-dev_4.4.1-3ubuntu9_arm64.deb ./libavutil56_4.4.1-3ubuntu9_arm64.deb ./libpostproc-dev_4.4.1-3ubuntu9_arm64.deb ./libpostproc55_4.4.1-3ubuntu9_arm64.deb ./libswresample-dev_4.4.1-3ubuntu9_arm64.deb ./libswresample3_4.4.1-3ubuntu9_arm64.deb ./libswscale-dev_4.4.1-3ubuntu9_arm64.deb ./libswscale5_4.4.1-3ubuntu9_arm64.deb --reinstall # 进入 mesa 目录 cd mesa # 安装 mesa apt install *.deb --reinstall # 完成安装即可执行以下指令启动 # 配置 HDMI 的 I2S 音频 amixer -c 1 set 'I2S1 Src Select' 'APBIF_TXDIF0' amixer -c 1 set 'I2S1OUT' on # 在正常使用音频之前,必须先运行-D hw:2,0命令。(每次启动只需要执行一次即可) # test.wav 可以自己随便搞个音频文件,最好是16Bit的,只测试过16Bit的音频文件 aplay test.wav -D hw:2,0 # 启动 Kodi kodi-standalone --windowing=gbm # 进入 Kodi 后配置硬件加速 # 在左上角点击“设置”图标(小齿轮)进入设置页面 # 依次选择进入:In Settings -> Player -> Videos # 进入Videos设置页面后,点击左下角的“Advanced”进入高级设置 # 在右侧将 Allow using DRM PRIME decoder 打开 # 再将 Allow hardware acceleration with DRM PRIME 打开 # 点击左上角的"Settings"返回到“设置”页面,选择"System"进入系统配置 # 选择左侧的“Audio”配置音频 # 在右侧点击"Audio output device"选择第二项输出
-
MangoPI MQ-Quad H616 Armbian 使用 USB ADB 连接设备 Shell
Armbian 使用 ADB 连接 MQ-Quad Shell
此贴使用的是芒果群里的@sputnik 大佬的Armbian
感谢 sputnik 的贡献让我们能用上MQ-Quad的Armbian
GitHub地址:https://github.com/open-cores/mangguo-h616-armbian
使用v22.08分支做的测试修改内核设备树
# 修改 path/kernel/archive/sunxi-5.19/xkernel-mangopimcore.patch 文件 # 关闭 ehci0 以及 ohci0 节点 +&ehci0 { + status = "disabled"; +}; +&ohci0 { + status = "disabled"; +}; # 修改 usbotg 节点的 dr_mode 为 peripheral 模式 +&usbotg { + dr_mode = "peripheral"; /* USB A type receptable */ + status = "okay"; +};
- 修改完成后重新编译imag并写入到SD卡,这里不做讲解了。
编译并安装 adbd
# 在设备中执行以下指令 git clone https://github.com/Evlers/adbd cd adbd # 编译以及安装 adbd make -j4 sudo make install
配置 USB Gadget 设备
- 让设备使用USB复合设备:
libcomposite
# 让 libcomposite 模块开机自动装载 su root echo "libcomposite" >> /etc/modules
- 进入sbin目录:
cd /usr/local/sbin
- 制作Starting脚本用于开机自动运行
vi usb-gadget-start.sh # 复制以下内容 #!/bin/bash # 设置 adbd 参数 BANNER="device" # bootloader sideload recovery device DEVNAME="MQ-Quad" DEVMODEL="Allwinner H616" DEVPRODUCT="MangoPI MQ-Quad" # 创建 usb adbd 设备 mkdir /sys/kernel/config/usb_gadget/g1 echo "0x18D1" > /sys/kernel/config/usb_gadget/g1/idVendor echo "0xD002" > /sys/kernel/config/usb_gadget/g1/idProduct # 写入USB描述 # 注意:serialnumber长度必须是16个字符 否则绑定USB控制器时会出现Device or resource busy的问题 mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409 echo "Allwinner" > /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer echo "MangoPI-MQ-Quad" > /sys/kernel/config/usb_gadget/g1/strings/0x409/product echo MangoPI--MQ-Quad > /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1 echo 0xc0 > /sys/kernel/config/usb_gadget/g1/configs/c.1/bmAttributes echo 500 > /sys/kernel/config/usb_gadget/g1/configs/c.1/MaxPower mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409 # 创建 ffs function 注册 functionfs 文件系统 mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.adb ln -s /sys/kernel/config/usb_gadget/g1/functions/ffs.adb/ /sys/kernel/config/usb_gadget/g1/configs/c.1/ffs.adb # 用户态挂在 adbd 的 functionfs 文件系统 mkdir /dev/usb-ffs mkdir /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb/ # 使用 bash 启动 adbd /usr/bin/adbd -d -n "$DEVNAME" -m "$DEVMODEL" -p "$DEVPRODUCT" -b "$BANNER" -s /bin/bash # 将 Gadget 绑定到USB控制器 echo `ls /sys/class/udc/` > /sys/kernel/config/usb_gadget/g1/UDC
- 制作Stopping脚本
vi usb-gadget-stop.sh # 复制以下内容 #!/bin/bash cd /sys/kernel/config/usb_gadget/g1 # disconnected echo `` > /sys/kernel/config/usb_gadget/g1/UDC # remove all links find . -type l -exec rm -v {} \; # rmdir configs/c.1/strings/0x409 find configs -name 'strings' -exec rmdir -v {}/0x409 \; #rmdir configs/c.1 ls -d configs/* | xargs rmdir -v #rmdir strings/0x409 ls -d strings/* | xargs rmdir -v #rmdir functions/hid.usb0 ls -d functions/* | xargs rmdir -v cd .. rmdir -v g1
- 给脚本提供执行权限
chmod +x usb-gadget-start.sh chmod +x usb-gadget-stop.sh
- 利用 Systemd 让 USB Gadget 以及 adbd 开机启动
vi /etc/systemd/system/usb-gadget.service # 复制以下内容 [Unit] Description=USB gadeget After=sys-kernel-config.mount Before=network-pre.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/sbin/usb-gadget-start.sh ExecStop=/usr/local/sbin/usb-gadget-stop.sh [Install] WantedBy=multi-user.target
- 使能开机启动:
sudo systemctl enable usb-gadget
- 重启设备:
reboot
测试
- 在PC端执行如下测试
# 查看设备 adb devices # 连接到设备Shell adb shell
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@ymy0820 将axp_set_dcdc4函数内的程序注释掉并return 0;不是注释掉函数
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@mangogeek 芒果大佬过奖了,您编译的 debian 能开源吗,想白嫖驱动 哈哈哈哈
-
MangoPi Dual T113 主线内核编译记录
awboot 编译(无需 SPL UBOOT 直接引导内核)
# 交叉编译器需使用 arm-none-eabi-gcc 以下是我交叉编译器的版本 gcc version 8.3.1 20190703 (release) [gcc-8-branch revision 273027] (GNU Tools for Arm Embedded Processors 8-2019-q3-update) # 下拉 awboot git clone https://github.com/szemzoa/awboot cd awboot # 编译工具 cd tools gcc mksunxi.c -o mksunxi # 修改 Makefile 中的 /bin/expr 为 /usr/bin/expr @/usr/bin/expr `/bin/cat .build_revision` + 1 > .build_revision # 编译 awboot make
测试 awboot
xfel write 0x30000 .\awboot.bin xfel exec 0x30000
写入 awboot 到 TF 卡
- 修改链接地址:arch/arm32/mach-t113s3/link.ld 文件中 ORIGIN = 0x00030000 修改为 ORIGIN = 0x00020000
- 修改完链接地址后需要清除重新编译
make clean all
- 写入到 TF 卡中:
sudo dd if=awboot.bin of=/dev/sdd bs=1024 seek=8
内核编译
- 这个是我修改好的主线稳定版内核(带WiFi):Linux-6.0.1
- 也选择去官网下载内核:kernel
- 修改 kernel.org 下载的内核源代码:
# 修改 drivers/clk/sunxi-ng/Kconfig 文件 config SUN20I_D1_CCU tristate "Support for the Allwinner D1 CCU" default RISCV && ARCH_SUNXI - depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST + depends on (ARCH_SUNXI) || COMPILE_TEST config SUN20I_D1_R_CCU tristate "Support for the Allwinner D1 PRCM CCU" default RISCV && ARCH_SUNXI - depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST + depends on (ARCH_SUNXI) || COMPILE_TEST # 修改 drivers/clk/sunxi-ng/ccu-sun20i-d1.c 文件 static SUNXI_CCU_MUX_DATA(cpux_clk, "cpux", cpux_parents, - 0x500, 24, 3, CLK_SET_RATE_PARENT); + 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); # 修改 arch/arm/mach-sunxi/platsmp.c 文件,在末尾添加以下内容 static int sun8i_t113_smp_boot_secondary(unsigned int cpu, struct task_struct *idle) { u32 reg; void __iomem *cpucfg_membase = ioremap(0x09010000, 0x10); void __iomem *cpuexec_membase[] = {ioremap(0x070005C4, 0x10),ioremap(0x070005C8, 0x10)}; if (cpu != 1) return 0; spin_lock(&cpu_lock); /* Set CPU boot address */ writel(__pa_symbol(secondary_startup), cpuexec_membase[cpu]); /* Deassert the CPU core reset */ reg = readl(cpucfg_membase); writel(reg | BIT(cpu), cpucfg_membase); spin_unlock(&cpu_lock); return 0; } static const struct smp_operations sun8i_t113_smp_ops __initconst = { .smp_boot_secondary = sun8i_t113_smp_boot_secondary, }; CPU_METHOD_OF_DECLARE(sun8i_t113_smp, "allwinner,sun8iw20p1", &sun8i_t113_smp_ops);
配置内核
- 先使用默认配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
- 再打开内核配置
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
- 打开芯片时钟支持:
> Device Drivers > Common Clock Framework <*> Clock support for Allwinner SoCs <*> Support for the Allwinner D1 CCU <*> Support for the Allwinner D1 PRCM CCU
添加设备树
- 将设备树添加到内核 arch/arm/boot/dts/ 目录中:sun8i-t113-mangopi-dual.dts sun8i-t113.dtsi
- 并在该目录 Makefile 文件中的CONFIG_MACH_SUN8I下添加改设备树文件:
dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a23-evb.dtb \ sun8i-a23-gt90h-v4.dtb \ sun8i-a23-inet86dz.dtb \ ..................... sun8i-v3s-licheepi-zero-dock.dtb \ sun8i-v40-bananapi-m2-berry.dtb \ sun8i-t113-mangopi-dual.dtb
编译
# 编译内核,设备树以及模块 make -j48 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs modules # 内核文件 arch/arm/boot/zImage # 设备树文件 arch/arm/boot/dts/sun8i-t113-mangopi-dual.dtb
启动日志
Allwinner T113-loader DRAM SIZE = 128M DRAM simple test OK. CPU freq=1200 MHz SD/MMC card at 'sdhci0' controller found SD/MMC: Image: Read file zImage addr=45000000 SD/MMC: dt blob: Read file sun8i-t113-mangopi-dual.dtb addr=41800000 booting linux... [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 6.0.1-g75e3c08038b8 (evler@DESKTOP-6BPS301) (arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0, GNU ld (GNU Binutils for Ubuntu) 2.30) #1 SMP Fri Oct 14 20:36:14 CST 2022 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d [ 0.000000] CPU: div instructions available: patching division code [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] OF: fdt: Machine model: MangoPi MQ-Dual [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] cma: Reserved 72 MiB at 0x43800000 [ 0.000000] Zone ranges: [ 0.000000] Normal [mem 0x0000000040000000-0x0000000047ffffff] [ 0.000000] HighMem empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040000000-0x0000000047ffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000047ffffff] [ 0.000000] percpu: Embedded 11 pages/cpu s15508 r8192 d21356 u45056 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32512 [ 0.000000] Kernel command line: mem=128M cma=72M root=/dev/mmcblk0p2 init=/sbin/init rootwait console=tty0 console=ttyS5,115200 [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear) [ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 43384K/131072K available (7168K kernel code, 942K rwdata, 2104K rodata, 1024K init, 266K bss, 13960K reserved, 73728K cma-reserved, 0K highmem) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 [ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. [ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns [ 0.000001] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns [ 0.000013] Switching to timer-based delay loop, resolution 41ns [ 0.000189] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns [ 0.000686] Console: colour dummy device 80x30 [ 0.000998] printk: console [tty0] enabled [ 0.001042] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000) [ 0.001071] pid_max: default: 32768 minimum: 301 [ 0.001240] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [ 0.001276] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) [ 0.001835] CPU: Testing write buffer coherency: ok [ 0.002166] /cpus/cpu@0 missing clock-frequency property [ 0.002215] /cpus/cpu@1 missing clock-frequency property [ 0.002237] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.003020] Setting up static identity map for 0x40100000 - 0x40100060 [ 0.003193] rcu: Hierarchical SRCU implementation. [ 0.003213] rcu: Max phase no-delay instances is 1000. [ 0.003749] smp: Bringing up secondary CPUs ... [ 0.004454] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.004581] smp: Brought up 1 node, 2 CPUs [ 0.004622] SMP: Total of 2 processors activated (96.00 BogoMIPS). [ 0.004638] CPU: All CPU(s) started in SVC mode. [ 0.005159] devtmpfs: initialized [ 0.009273] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5 [ 0.009513] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.009556] futex hash table entries: 512 (order: 3, 32768 bytes, linear) [ 0.011856] pinctrl core: initialized pinctrl subsystem [ 0.013201] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.014339] DMA: preallocated 256 KiB pool for atomic coherent allocations [ 0.015229] thermal_sys: Registered thermal governor 'step_wise' [ 0.015529] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [ 0.015578] hw-breakpoint: maximum watchpoint size is 8 bytes. [ 0.023287] platform 5460000.tcon-top: Fixing up cyclic dependency with 5200000.mixer [ 0.023396] platform 5460000.tcon-top: Fixing up cyclic dependency with 5100000.mixer [ 0.023705] platform 5461000.lcd-controller: Fixing up cyclic dependency with 5460000.tcon-top [ 0.024089] platform 5470000.lcd-controller: Fixing up cyclic dependency with 5604000.tv-encoder [ 0.024169] platform 5470000.lcd-controller: Fixing up cyclic dependency with 5460000.tcon-top [ 0.025007] platform 7090000.rtc: Fixing up cyclic dependency with 7010000.clock-controller [ 0.035143] SCSI subsystem initialized [ 0.035656] usbcore: registered new interface driver usbfs [ 0.035715] usbcore: registered new interface driver hub [ 0.035764] usbcore: registered new device driver usb [ 0.035998] mc: Linux media interface: v0.10 [ 0.036059] videodev: Linux video capture interface: v2.00 [ 0.036145] pps_core: LinuxPPS API ver. 1 registered [ 0.036162] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.036192] PTP clock support registered [ 0.036650] Advanced Linux Sound Architecture Driver Initialized. [ 0.037823] clocksource: Switched to clocksource arch_sys_counter [ 0.045181] NET: Registered PF_INET protocol family [ 0.045408] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.045967] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.046019] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear) [ 0.046044] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear) [ 0.046076] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear) [ 0.046105] TCP: Hash tables configured (established 1024 bind 1024) [ 0.046201] UDP hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.046248] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) [ 0.046434] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.047125] RPC: Registered named UNIX socket transport module. [ 0.047166] RPC: Registered udp transport module. [ 0.047180] RPC: Registered tcp transport module. [ 0.047192] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.048343] Initialise system trusted keyrings [ 0.048634] workingset: timestamp_bits=30 max_order=15 bucket_order=0 [ 0.053533] NFS: Registering the id_resolver key type [ 0.053617] Key type id_resolver registered [ 0.053634] Key type id_legacy registered [ 0.053689] Key type asymmetric registered [ 0.053705] Asymmetric key parser 'x509' registered [ 0.053840] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246) [ 0.053866] io scheduler mq-deadline registered [ 0.053879] io scheduler kyber registered [ 0.112158] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled [ 0.121805] CAN device driver interface [ 0.122573] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 0.122600] ehci-platform: EHCI generic platform driver [ 0.122740] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 0.122778] ohci-platform: OHCI generic platform driver [ 0.125187] sun6i-rtc 7090000.rtc: registered as rtc0 [ 0.125338] sun6i-rtc 7090000.rtc: setting system clock to 1970-01-02T00:10:37 UTC (87037) [ 0.125500] sun6i-rtc 7090000.rtc: RTC enabled [ 0.125852] i2c_dev: i2c /dev entries driver [ 0.127617] sunxi-wdt 20500a0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0) [ 0.128870] sun8i-ce 3040000.crypto: Set mod clock to 300000000 (300 Mhz) from 400000000 (400 Mhz) [ 0.129231] sun8i-ce 3040000.crypto: will run requests pump with realtime priority [ 0.129586] sun8i-ce 3040000.crypto: will run requests pump with realtime priority [ 0.129826] sun8i-ce 3040000.crypto: will run requests pump with realtime priority [ 0.130039] sun8i-ce 3040000.crypto: will run requests pump with realtime priority [ 0.130195] sun8i-ce 3040000.crypto: Register cbc(aes) [ 0.130230] sun8i-ce 3040000.crypto: Register ecb(aes) [ 0.130249] sun8i-ce 3040000.crypto: Register cbc(des3_ede) [ 0.130268] sun8i-ce 3040000.crypto: Register ecb(des3_ede) [ 0.130307] sun8i-ce 3040000.crypto: CryptoEngine Die ID 0 [ 0.131201] usbcore: registered new interface driver usbhid [ 0.131233] usbhid: USB HID core driver [ 0.133879] NET: Registered PF_PACKET protocol family [ 0.133934] can: controller area network core [ 0.134023] NET: Registered PF_CAN protocol family [ 0.134045] can: raw protocol [ 0.134058] can: broadcast manager protocol [ 0.134075] can: netlink gateway - max_hops=1 [ 0.134293] Key type dns_resolver registered [ 0.134448] Registering SWP/SWPB emulation handler [ 0.134555] Loading compiled-in X.509 certificates [ 0.152533] sun20i-d1-pinctrl 2000000.pinctrl: initialized sunXi PIO driver [ 0.174214] 2500400.serial: ttyS1 at MMIO 0x2500400 (irq = 231, base_baud = 1500000) is a 16550A [ 0.195942] 2501400.serial: ttyS5 at MMIO 0x2501400 (irq = 232, base_baud = 1500000) is a 16550A [ 1.049330] printk: console [ttyS5] enabled [ 1.055564] phy phy-4100400.phy.0: Changing dr_mode to 1 [ 1.056783] usb_phy_generic usb_phy_generic.1.auto: dummy supplies not allowed for exclusive requests [ 1.060995] ehci-platform 4101000.usb: EHCI Host Controller [ 1.070724] musb-hdrc musb-hdrc.2.auto: MUSB HDRC host driver [ 1.075755] ehci-platform 4101000.usb: new USB bus registered, assigned bus number 1 [ 1.081516] musb-hdrc musb-hdrc.2.auto: new USB bus registered, assigned bus number 2 [ 1.090282] ehci-platform 4200000.usb: EHCI Host Controller [ 1.097935] hub 2-0:1.0: USB hub found [ 1.104550] ohci-platform 4200400.usb: Generic Platform OHCI controller [ 1.106450] hub 2-0:1.0: 1 port detected [ 1.117184] ehci-platform 4101000.usb: irq 233, io mem 0x04101000 [ 1.123361] ehci-platform 4200000.usb: new USB bus registered, assigned bus number 3 [ 1.127942] ohci-platform 4200400.usb: new USB bus registered, assigned bus number 4 [ 1.140803] ehci-platform 4200000.usb: irq 235, io mem 0x04200000 [ 1.147129] sunxi-mmc 4020000.mmc: Got CD GPIO [ 1.148376] ehci-platform 4101000.usb: USB 2.0 started, EHCI 1.00 [ 1.157972] ohci-platform 4200400.usb: irq 237, io mem 0x04200400 [ 1.159104] ALSA device list: [ 1.167091] No soundcards found. [ 1.171251] sunxi-mmc 4021000.mmc: allocated mmc-pwrseq [ 1.176832] hub 1-0:1.0: USB hub found [ 1.177242] sunxi-mmc 4020000.mmc: initialized, max. request size: 2048 KB, uses new timings mode [ 1.180665] ehci-platform 4200000.usb: USB 2.0 started, EHCI 1.00 [ 1.195722] hub 1-0:1.0: 1 port detected [ 1.200970] hub 3-0:1.0: USB hub found [ 1.204802] hub 3-0:1.0: 1 port detected [ 1.212314] sunxi-mmc 4021000.mmc: initialized, max. request size: 2048 KB, uses new timings mode [ 1.229522] sunxi-mmc 4021000.mmc: card claims to support voltages below defined range [ 1.232548] hub 4-0:1.0: USB hub found [ 1.241326] hub 4-0:1.0: 1 port detected [ 1.257235] mmc1: new high speed SDIO card at address 0001 [ 1.284358] mmc0: new high speed SDHC card at address aaaa [ 1.290803] mmcblk0: mmc0:aaaa SL32G 29.7 GiB [ 1.300997] mmcblk0: p1 p2 [ 1.307944] ohci-platform 4101400.usb: Generic Platform OHCI controller [ 1.314620] ohci-platform 4101400.usb: new USB bus registered, assigned bus number 5 [ 1.322709] ohci-platform 4101400.usb: irq 236, io mem 0x04101400 [ 1.402615] hub 5-0:1.0: USB hub found [ 1.406430] hub 5-0:1.0: 1 port detected [ 1.443652] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: disabled. [ 1.452694] VFS: Mounted root (ext4 filesystem) readonly on device 179:2. [ 1.467648] devtmpfs: mounted [ 1.471630] Freeing unused kernel image (initmem) memory: 1024K [ 1.478021] Run /sbin/init as init process [ 1.840340] EXT4-fs (mmcblk0p2): re-mounted. Quota mode: disabled. Starting syslogd: OK Starting klogd: OK Running sysctl: OK Starting mdev... OK [ 2.771703] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 2.815733] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' Initializing random number generator: OK Saving random seed: [ 5.777828] random: crng init done OK Starting system message bus: done Starting network: OK Starting WiFi: Successfully initialized wpa_supplicant OK udhcpc: started, v1.35.0 udhcpc: broadcasting discover Starting sshd: OK Welcome to MangoPi Dual buildroot login: root [root@buildroot]:~$ udhcpc: broadcasting discover udhcpc: broadcasting select for 192.168.10.211, server 192.168.10.251 udhcpc: lease of 192.168.10.211 obtained from 192.168.10.251, lease time 43200 deleting routers adding dns 192.168.10.251 [root@buildroot]:~$ free -h total used free shared buff/cache available Mem: 115.4M 12.7M 79.8M 60.0K 22.8M 97.0M Swap: 0 0 0 [root@buildroot]:~$ df -h Filesystem Size Used Available Use% Mounted on /dev/root 29.0G 21.8M 27.4G 0% / devtmpfs 21.2M 0 21.2M 0% /dev tmpfs 57.7M 0 57.7M 0% /dev/shm tmpfs 57.7M 32.0K 57.7M 0% /tmp tmpfs 57.7M 28.0K 57.7M 0% /run [root@buildroot]:~$ uname -a Linux buildroot 6.0.1-g75e3c08038b8 #1 SMP Fri Oct 14 20:36:14 CST 2022 armv7l GNU/Linux [root@buildroot]:~$ iperf3 -s warning: this system does not seem to support IPv6 - trying IPv4 ----------------------------------------------------------- Server listening on 5201 (test #1) ----------------------------------------------------------- Accepted connection from 192.168.10.246, port 8252 [ 5] local 192.168.10.211 port 5201 connected to 192.168.10.246 port 8254 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 3.92 MBytes 32.9 Mbits/sec [ 5] 1.00-2.00 sec 5.59 MBytes 46.9 Mbits/sec [ 5] 2.00-3.00 sec 5.49 MBytes 46.1 Mbits/sec [ 5] 3.00-4.00 sec 5.69 MBytes 47.7 Mbits/sec [ 5] 4.00-5.00 sec 5.76 MBytes 48.3 Mbits/sec [ 5] 5.00-6.00 sec 5.72 MBytes 48.0 Mbits/sec [ 5] 6.00-7.00 sec 5.79 MBytes 48.5 Mbits/sec [ 5] 7.00-8.00 sec 5.54 MBytes 46.5 Mbits/sec [ 5] 8.00-9.00 sec 5.48 MBytes 45.9 Mbits/sec [ 5] 9.00-10.00 sec 5.70 MBytes 47.8 Mbits/sec [ 5] 10.00-10.04 sec 239 KBytes 48.0 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate [ 5] 0.00-10.04 sec 54.9 MBytes 45.9 Mbits/sec receiver ----------------------------------------------------------- Server listening on 5201 (test #2) -----------------------------------------------------------
给 TF 卡分区以及跟文件系统的制作等,这里就不再讲解,可以参考我写的另一篇帖子:MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@fumoumou 那就不清楚了,你检查下流程,试下我对应的uboot版本,还有开发板不要装TF卡,我这没装SPI Flash的,串口用PH0跟PH1脚。
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@fumoumou 串口接对没,贴上fel的log看看写进去了不
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
制作 TF 启动镜像
准备工作
# 创建 images 目录 mkdir images cd images # 收集需要用到的文件到 file 目录 mkdir file cp ../u-boot/u-boot-sunxi-with-spl.bin ./file cp ../linux-5.19.0/arch/arm64/boot/Image ./file cp ../linux-5.19.0/arch/arm64/boot/dts/allwinner/mq-quad.dtb ./file // 这里我已经单独做了个设备树文件 cp ../buildroot-2022.02.5/output/images/rootfs.tar ./file # 制作空的 img 文件 sudo dd if=/dev/zero of=./sdcard.img bs=1M count=512
分区
sudo fdisk ./sdcard.img n p 1 40960 +131072 // 64MB n p 2 172033 1048575 // 默认 w
关联 img 文件到 loop
sudo losetup -f ./sdcard.img #查看关联到哪个位置 sudo losetup -l /dev/loop11 0 0 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img
写入 uboot 到 img 文件中偏移 8KB 的位置
sudo dd if=./file/u-boot-sunxi-with-spl.bin of=/dev/loop11 bs=8K seek=1
关联分区设备
# 参考分区: 设备 启动 起点 末尾 扇区 大小 Id 类型 ./sdcard.img1 40960 172032 131073 64M 83 Linux ./sdcard.img2 172033 1048575 876543 428M 83 Linux # -o (起始扇区 * 扇区大小)--sizelimit (扇区数量 * 扇区大小) 字节 sudo losetup -f -o 20971520 --sizelimit 67109376 sdcard.img sudo losetup -f -o 88080896 --sizelimit 448790016 sdcard.img #查看关联到哪个位置 sudo losetup -l /dev/loop30 67109376 20971520 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img /dev/loop26 448790016 88080896 0 0 /home/evler/Allwinner/MangoPi/Quad/mainline/images/sdcard.img
格式化并挂载分区
sudo mkfs.fat /dev/loop30 sudo mkfs.ext4 /dev/loop26 sudo mount /dev/loop30 /mnt/boot/ sudo mount /dev/loop26 /mnt/rootfs/
制作uboot引导脚本
# 创建 boot.cmd 文件 vi boot.cmd # 复制以下内容 setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw setenv bootcmd fatload mmc 0:1 0x4fc00000 boot.scr; fatload mmc 0:1 0x40200000 Image; fatload mmc 0:1 0x4fa00000 mq-quad.dtb; booti 0x40200000 - 0x4fa00000 # 生成 boot.scr 文件 mkimage -C none -A arm64 -T script -d boot.cmd boot.scr
制作 boot 分区
sudo cp ./file/Image /mnt/boot/ sudo cp ./file/mq-quad.dtb /mnt/boot/ sudo cp ./file/boot.scr /mnt/boot/
制作 rootfs
# 解压 buildroot 制作出来的根文件系统压缩文件到 rootfs 分区 sudo tar -vxf ./file/rootfs.tar -C /mnt/rootfs/ # 安装内核模块到 rootfs 分区 cd ../linux-5.19.0/ sudo make INSTALL_MOD_PATH=/mnt/rootfs/ modules_install
卸载文件系统
sync sudo umount /mnt/rootfs sudo umount /mnt/boot
取消环路的关联
sudo losetup -d /dev/loop30 sudo losetup -d /dev/loop26 sudo losetup -d /dev/loop11
写入到 TF 卡进行测试
sudo dd if=./sdcard.img of=/dev/sdd
-
回复: kernel输出串口bootargs设置ttyS0没输出
可能内核在初始化串口前就挂了
无法输出串口日志的调试记录
- 打开 earlycon 功能,让内核使用 uboot 初始化好的串口进行输出:
> Device Drivers > Character devices > Serial drivers [*] Early console using ARM semihosting
- 在 bootargs 变量中带上 earlycon 参数
-
回复: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
参考文章:
https://linux-sunxi.org/U-Boot
https://linux-sunxi.org/Sunxi-tools
https://linux-sunxi.org/FEL/USBBoothttps://linux-sunxi.org/Mainline_Kernel_Howto
https://linux-sunxi.org/U-Boot#Install_U-Boot感谢芒果群里两位 @sputnik @Syter 大佬的调试帮助
-
MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
U-Boot 构建并从USB启动
安装 sunxi-fel 工具:
git clone https://github.com/linux-sunxi/sunxi-tools cd sunxi-tools/ make
Arm Trusted Firmware (arm64)
git clone https://github.com/ARM-software/arm-trusted-firmware.git cd arm-trusted-firmware make CROSS_COMPILE=aarch64-linux-gnu- PLAT=<platform> DEBUG=1 bl31 # platform = sun50i-h616
下拉最新的 u-boot
git clone git://git.denx.de/u-boot.git cd u-boot
修改 u-boot
- MQ-Quad 没有以太网接口 执行 make menuconfig 在主页关闭网络支持:【】Networking support
- MQ-Quad 使用 axp313 电源管理芯片 修改drivers/power/axp305.c文件:
# 注释掉 DCDC4 的设置 axp313并没有这路输出 int axp_set_dcdc4(unsigned int mvolt) { int ret; u8 cfg; #if 0 if (mvolt >= 1600) cfg = AXP305_DCDC4_1600MV_OFFSET + axp305_mvolt_to_cfg(mvolt, 1600, 3300, 100); else cfg = axp305_mvolt_to_cfg(mvolt, 600, 1500, 20); if (mvolt == 0) return pmic_bus_clrbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); ret = pmic_bus_write(AXP305_DCDCD_VOLTAGE, cfg); if (ret) return ret; return pmic_bus_setbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); #endif return 0; } # 添加 DCDC3 的电压设置 #define AXP305_DCDC3_1200MV_OFFSET 71 int axp_set_dcdc3(unsigned int mvolt) { int ret; u8 cfg; if (mvolt >= 1220) { cfg = AXP305_DCDC3_1200MV_OFFSET + axp305_mvolt_to_cfg(mvolt, 1220, 1840, 20); } else cfg = axp305_mvolt_to_cfg(mvolt, 500, 1200, 10); if (mvolt == 0) return pmic_bus_clrbits(AXP305_OUTPUT_CTRL1, AXP305_OUTPUT_CTRL1_DCDCD_EN); ret = pmic_bus_write(AXP305_DCDCD_VOLTAGE, cfg); if (ret) return ret; return pmic_bus_setbits(AXP305_OUTPUT_CTRL1, 0x1f); } # 修改芯片版本的检测 以及 设置 DCDC3 的电压为1.5v int axp_init(void) { u8 axp_chip_id; int ret; ret = pmic_bus_init(); if (ret) return ret; ret = pmic_bus_read(AXP305_CHIP_VERSION, &axp_chip_id); if (ret) return ret; // if ((axp_chip_id & AXP305_CHIP_VERSION_MASK) != 0x40) // return -ENODEV; if ((axp_chip_id & AXP305_CHIP_VERSION_MASK) != 0x4b) return -ENODEV; printf("pmic id is 0x%x\n",axp_chip_id); axp_set_dcdc3(1500); return ret; }
编译 u-boot
make CROSS_COMPILE=aarch64-linux-gnu- BL31=../arm-trusted-firmware/build/sun50i_h616/debug/bl31.bin orangepi_zero2_defconfig make CROSS_COMPILE=aarch64-linux-gnu- BL31=../arm-trusted-firmware/build/sun50i_h616/debug/bl31.bin
测试 u-boot
- 通过 USB 启动 u-boot
../sunxi-tools/sunxi-fel uboot u-boot-sunxi-with-spl.bin
UART0 中输出 LOG
U-Boot SPL 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) pmic id is 0x4b DRAM: 1024 MiB Trying to boot from FEL NOTICE: BL31: v2.7(debug):v2.7.0-312-g9a5dec669 NOTICE: BL31: Built : 17:14:37, Sep 3 2022 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a081ff0, model: OrangePi Zero2 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied INFO: BL31: cortex_a53: CPU workaround for 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree. U-Boot 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) Allwinner Technology CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero2 DRAM: 1 GiB Core: 49 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from FAT... MMC: no card present ** Bad device specification mmc 0 ** In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Hit any key to stop autoboot: 0 MMC: no card present =>
主线 Kernel 编译
拉取/下载压缩 主线内核
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git # 速度较慢,直接去官网下载 mainline 内核:https://kernel.org # 解压内核 tar -xvzf linux-6.0-rc3.tar.gz
修改设备树
/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
# 因为 MQ-Quad 的 3.3v 是没接 pmic 来控制的,所以要添加固定 3.3v 的节点 # 在 reg_vcc5v 节点下面添加 reg_vcc3v3 节点 (否则无法初始化IO,导致串口无法初始化) reg_vcc3v3: vcc3v3 { compatible = "regulator-fixed"; regulator-name = "vcc-3v3"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; }; # 修改 pio 节点中的 reg_aldo1 为 reg_vcc3v3 &pio { vcc-pc-supply = <®_vcc3v3>; vcc-pf-supply = <®_vcc3v3>; vcc-pg-supply = <®_vcc3v3>; vcc-ph-supply = <®_vcc3v3>; vcc-pi-supply = <®_vcc3v3>; }; # 修改 mmc0 的 vmmc-supply 的 reg_dcdce 为 reg_vcc3v3(否则无法启动 sunxi-mmc 驱动) &mmc0 { vmmc-supply = <®_vcc3v3>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ bus-width = <4>; status = "okay"; };
配置编译
# 使用默认配置 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig # 编译内核镜像 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 Image # 编译设备树 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 dtbs # 编译模块(可选,后面做了文件系统后再使用) make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8 modules make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=<any-path-you-like> modules modules_install 构建成功后,可以在提供的 INSTALL_MOD_PATH 目录中找到模块 # 安装头文件(可选,后面做了文件系统后再使用) make ARCH=arm64 INSTALL_HDR_PATH=<any-path-you-like> headers_install 将 INSTALL_HDR_PATH 更改为希望安装到的路径,例如/usr或<some_prefix>/usr 方便后期交叉编译
制作引导脚本(当然也可以在uboot中设置变量并执行booti)
- 制作 boot.cmd 文件, USB 写入内核直接使用固定地址启动
vi boot.cmd # 复制以下内容 setenv bootargs console=ttyS0,115200 booti 0x40200000 - 0x4fa00000
- 转换打包boot.scr文件:
mkimage -C none -A arm64 -T script -d boot.cmd boot.scr
- booti 讲解:
在u-boot中,bootm是一个可以执行位于memory中的应用程序的命令
booti是bootm命令的一个子集,可用于执行位于memory中的ARM64 kernel Image,其格式如下:
booti addr [initrd[:size]] [fdt]
其中:addr是kernel Image文件所在的memory地址;[initrd[:size]]是initrd在memory中的位置和size,可以不指定,使用“-”代替即可;fdt是flat device tree(就是传说中的dtb文件)在memory中的地址,在ARM64中,它是必选的
测试 USB 启动内核
sunxi-fel -v uboot u-boot-sunxi-with-spl.bin \ write 0x40200000 Image \ write 0x4fa00000 sun50i-a64-pine64-lts.dtb \ write 0x4fc00000 boot.scr \ write 0x4ff00000 rootfs.cpio.lzma.uboot # 例如: ./sunxi-tools/sunxi-fel -v uboot u-boot/u-boot-sunxi-with-spl.bin \ write 0x40200000 linux-6.0-rc3/arch/arm64/boot/Image \ write 0x4fa00000 linux-6.0-rc3/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dtb \ write 0x4fc00000 boot.scr
从 TF 卡启动 SPL、U-Boot、Kernel
制作启动盘
# 进入磁盘管理 fdisk /dev/sdd # 多执行几次删除所有分区 d # 新建分区 (扇区为单位,前面空开20MB用于存放uboot,制作128MB的分区) n p 40960 303104 w # 进行 FAT 格式化 sudo mkfs.fat /dev/sdd1 # 写入 uboot 到 8KB 的位置 sudo dd if=./u-boot/u-boot-sunxi-with-spl.bin of=/dev/sdd bs=8K seek=1 # 挂载 FAT 文件系统 sudo mount /dev/sdd1 /mnt/boot/ # 复制内核以及设备树到FAT分区 sudo cp linux-6.0-rc3/arch/arm64/boot/Image /mnt/boot/ sudo cp linux-6.0-rc3/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dtb /mnt/boot/ # 卸载 FAT 文件系统 sudo umount /mnt/boot
测试 TF 卡启动内核
# 手动装载内核以及设备树并启动 fatload mmc 0:1 0x40200000 Image fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb setenv bootargs 'console=ttyS0,115200 earlycon' booti 0x40200000 - 0x4fa00000 # 使用如下设置变量并保存到FAT分区 setenv bootargs 'console=ttyS0,115200' setenv bootcmd 'fatload mmc 0:1 0x40200000 Image;fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb;booti 0x40200000 - 0x4fa00000' saveenv # 使用 bootcmd 启动 boot
Buildroot 构建
buildroot-2022.02.5
配置编译
make menuconfig # 配置 Target options > Target options Target Architecture (AArch64 (little endian)) ---> Target Binary Format (ELF) ---> Target Architecture Variant (cortex-A53) ---> Floating point strategy (VFPv4) ---> # 配置 Toolchain > Toolchain Toolchain type (External toolchain) ---> Toolchain (Custom toolchain) ---> Toolchain origin (Pre-installed toolchain) ---> (/usr/local/arm64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu$ /usr/local/arm64/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu) Toolchain path (aarch64-linux-gnu-) Toolchain prefix //需要按住shift才能删减 External toolchain gcc version (7.x) ---> External toolchain kernel headers series (4.10.x) ---> //查看补充 [*] Toolchain has SSP support? (NEW) [*] Toolchain has RPC support? (NEW) [*] Toolchain has C++ support? [*] Enable MMU support (NEW) # 配置 Filesystem images -> Filesystem images -> [*] ext2/3/4 root filesystem //如果是 EMMC 或 SD 卡的话就用 ext3/ext4 -> ext2/3/4 variant = ext4 //选择 ext4 格式 -> exact size =128M //ext4 格式根文件系统 1GB(根据实际情况修改) -> [*] ubi image containing an ubifs root filesystem //如果使用 NAND 的话就用 ubifs # 编译 make -j8
补充
- External toolchain kernel headers series 的设置:
cat /usr/aarch64-linux-gnu/include/linux/version.h
#define LINUX_VERSION_CODE 266002 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) # 266002 转十六进制为 40A03 则版本号为 4.10.3
制作根文件系统到 TF 卡
# 新建第二分区 128MB 从 303106 扇区开始 sudo fdisk /dev/sdc n p 2 303106 +262144 w # 格式化文件系统为 ext4 sudo mkfs.ext4 /dev/sdc2 # 装载并复制文件系统 sudo mount /dev/sdc2 /mnt/rootfs/ sudo cp ./output/images/rootfs.tar /mnt/rootfs/ sudo tar -vxf /mnt/rootfs/rootfs.tar -C /mnt/rootfs sudo rm /mnt/rootfs/rootfs.tar sudo umount /mnt/rootfs
测试文件系统
# 在进入 uboot 后检查文件是否存在 ext4ls mmc 0:2 # 设置启动命令 setenv bootcmd 'fatload mmc 0:1 0x40200000 Image;fatload mmc 0:1 0x4fa00000 sun50i-h616-orangepi-zero2.dtb;booti 0x40200000 - 0x4fa00000' # 设置 bootargs 变量 setenv bootargs 'console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw init=/sbin/init debug panic=30' # 启动内核以及根文件系统 boot
添加网络支持
因为6.0的内核太新了,很多驱动没支持,所以使用稳定版内核进行驱动的移植
下拉内核
- H616主线内核维护者的内核:git clone -b h616-v13 https://github.com/apritzel/linux
- 使用主线需修改设备树,按照主线内核的修改配置方法
移植 RTL8723DS WiFi 驱动
- git clone https://github.com/lwfinger/rtl8723ds 到 /drivers/net/wireless/realtek/rtl8723ds 目录中
- 修改 rtl8723ds 的 Kconfig 中 ---help--- 为 help
config RTL8723DS tristate "Realtek 8723D SDIO or SPI WiFi" help Help message of RTL8723DS
- 修改 /drivers/net/wireless/realtek/ 目录中的Kconfig、Makefile:
# Kconfig 中添加新的驱动 source "drivers/net/wireless/realtek/rtl8723ds/Kconfig" # Makefile 中添加新的驱动 obj-$(CONFIG_RTL8723DS) += rtl8723ds/
打开 WiFi(RTL8723DS) 支持
# make menuconfig > Device Drivers > > Network device support > > Wireless LAN > [*] Realtek devices > <M> Realtek 8723D SDIO or SPI WiFi # 编译内核模块(在此我已经将 ARCH 以及 CROSS_COMPILE 固定到Makefile中,所以不需要带参) make modules -j8
Kernel 设备树配置
# 在 reg_vcc3v3 后面添加 WiFi 的电源配置 reg_vcc33_wifi: vcc33-wifi { /* Always on 3.3V regulator for WiFi and BT */ compatible = "regulator-fixed"; regulator-name = "vcc33-wifi"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; vin-supply = <®_vcc5v>; }; reg_vcc_wifi_io: vcc-wifi-io { /* Always on 1.8V/300mA regulator for WiFi and BT IO */ compatible = "regulator-fixed"; regulator-name = "vcc-wifi-io"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-always-on; vin-supply = <®_vcc33_wifi>; }; wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc 1>; clock-names = "osc32k-out"; reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */ post-power-on-delay-ms = <200>; }; # 添加 WiFi 的 mmc1 配置 &mmc1 { vmmc-supply = <®_vcc33_wifi>; vqmmc-supply = <®_vcc_wifi_io>; mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; mmc-ddr-1_8v; status = "okay"; }; # 编译设备树 make dtbs
- 完成后需要重新拷贝新的设备树到 FAT 分区
Buildrootfs 配置
make menuconfig
# 使用 mdev 动态加载模块 > System configuration Init system (BusyBox) ---> /dev management (Dynamic using devtmpfs + mdev) ---> # 打开网络支持 > Target packages > Networking applications [*] iperf3 // 用于网速测试 [*] lftp // 用于网络文件传输 [*] SFTP protocol // 使能 SFTP 协议 [*] openssh // 使能远程 ssh [*] wpa_supplicant ---> // 使能 wpa 用于WiFi控制 [*] Install wpa_cli binary > System tools [*] htop
make -j8
复制新的文件系统并安装模块
# 在buildroot中执行 替换根文件系统 sudo mount /dev/sdd2 /mnt/rootfs sudo rm -rf /mnt/rootfs/* sudo cp output/images/rootfs.tar /mnt/rootfs/ sudo tar -xvf /mnt/rootfs/rootfs.tar -C /mnt/rootfs/ # 在内核中执行 安装模块到第二分区的rootfs中(因为内核没经过裁剪会有大量的模块安装到第二分区,可能需要调整下第二分区的大小) make INSTALL_MOD_PATH=/mnt/rootfs/ modules modules_install # 卸载rootfs sync sudo umount /mnt/rootfs/
测试网络
# 检查WiFi是否自动挂载 # lsmod Module Size Used by ipv6 462848 18 8723ds 1466368 0 cfg80211 380928 1 8723ds rfkill 36864 2 cfg80211 sunxi_wdt 20480 0 dwmac_sun8i 28672 0 stmmac_platform 20480 1 dwmac_sun8i stmmac 221184 2 dwmac_sun8i,stmmac_platform pcs_xpcs 24576 1 stmmac crct10dif_ce 20480 1 # 配置 WiFi # vi /etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant ap_scan=1 network={ ssid="you wifi ssid" psk="you wifi password" } # 连接WiFi # ifconfig wlan0 up # wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B # udhcpc -i wlan0 # 配置开机自动连接 WiFi # vi /etc/init.d/S45wifi #!/bin/sh # # wlan0 Starts WiFi. # start() { printf "Starting WiFi: " ifconfig wlan0 up wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B udhcpc -i wlan0 echo "OK" } stop() { printf "Stopping WiFi: " killall udhcpc killall wpa_supplicant echo "OK" } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $? # chmod +x /etc/init.d/S45wifi # 网络测速 # iperf3 -c 192.168.10.164 Connecting to host 192.168.10.164, port 5201 [ 5] local 192.168.10.196 port 43126 connected to 192.168.10.164 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 1.75 MBytes 14.7 Mbits/sec 0 93.3 KBytes [ 5] 1.00-2.00 sec 2.17 MBytes 18.2 Mbits/sec 0 123 KBytes [ 5] 2.00-3.00 sec 2.42 MBytes 20.3 Mbits/sec 0 151 KBytes [ 5] 3.00-4.00 sec 2.92 MBytes 24.5 Mbits/sec 0 158 KBytes [ 5] 4.00-5.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 5.00-6.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 6.00-7.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 7.00-8.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 8.00-9.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes [ 5] 9.00-10.00 sec 2.61 MBytes 21.9 Mbits/sec 0 167 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 24.9 MBytes 20.9 Mbits/sec 0 sender [ 5] 0.00-10.00 sec 24.2 MBytes 20.3 Mbits/sec receiver iperf Done. # 远程连接 ssh 配置 sshd_config 文件 # vi /etc/ssh/sshd_config PermitRootLogin yes //修改 AllowUsers root //添加 # 重启 sshd 服务 # /etc/init.d/S50sshd restart # 设置 root 密码 # passwd root # 配置终端 # vi /etc/profile.d/myprofile.sh #!/bin/sh PS1='[\u@\h]:\w$ ' export PS1 # chmod +x /etc/profile.d/myprofile.sh # source /etc/profile.d/myprofile.sh
启动日志
U-Boot SPL 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) pmic id is 0x4b DRAM: 1024 MiB Trying to boot from MMC1 NOTICE: BL31: v2.7(debug):v2.7.0-312-g9a5dec669 NOTICE: BL31: Built : 17:14:37, Sep 3 2022 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a081ff0, model: OrangePi Zero2 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied INFO: BL31: cortex_a53: CPU workaround for 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree. U-Boot 2022.10-rc3-00069-g67fe8cc001-dirty (Sep 03 2022 - 18:10:41 +0800) Allwinner Technology CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero2 DRAM: 1 GiB Core: 49 devices, 17 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from FAT... OK In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Hit any key to stop autoboot: 0 35908096 bytes read in 1489 ms (23 MiB/s) 13222 bytes read in 2 ms (6.3 MiB/s) ## Flattened Device Tree blob at 4fa00000 Booting using the fdt blob at 0x4fa00000 Loading Device Tree to 0000000049ff9000, end 0000000049fff3a5 ... OK Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034] [ 0.000000] Linux version 5.19.0-rc1-609706-gc465e81f8859-dirty (evler@evler-Standard-PC-i440FX-PIIX-1996) (aarch64-linux-gnu-g2 [ 0.000000] Machine model: MQ-Quad_H616 [ 0.000000] efi: UEFI not found. []t[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] NUMA: NODE_DATA [mem 0x7fdebb40-0x7fdedfff] [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] DMA32 empty [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000040000000-0x000000004003ffff] [ 0.000000] node 0: [mem 0x0000000040040000-0x000000007fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000007fffffff] [ 0.000000] cma: Reserved 32 MiB at 0x000000007cc00000 [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.1 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] psci: MIGRATE_INFO_TYPE not supported. [ 0.000000] psci: SMC Calling Convention v1.2 [ 0.000000] percpu: Embedded 19 pages/cpu s40808 r8192 d28824 u77824 [ 0.000000] pcpu-alloc: s40808 r8192 d28824 u77824 alloc=19*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Detected VIPT I-cache on CPU0 [ 0.000000] CPU features: detected: ARM erratum 845719 [ 0.000000] Fallback order for Node 0: 0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 258048 [ 0.000000] Policy zone: DMA [ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw init=/sbin/init debug pa0 [ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear) [ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear) [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 959476K/1048576K available (15680K kernel code, 3386K rwdata, 8928K rodata, 6912K init, 577K bss, 56332K re) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] rcu: Preemptible hierarchical RCU implementation. [ 0.000000] rcu: RCU event tracing is enabled. [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4. [ 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 25 jiffies. [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] Root IRQ handler: gic_handle_irq [ 0.000000] GIC: Using split EOI/Deactivate mode [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. [ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys). [ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns [ 0.000000] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns [ 0.000676] Console: colour dummy device 80x25 [ 0.000771] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000) [ 0.000786] pid_max: default: 32768 minimum: 301 [ 0.000858] LSM: Security Framework initializing [ 0.000989] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.001005] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear) [ 0.002687] cblist_init_generic: Setting adjustable number of callback queues. [ 0.002711] cblist_init_generic: Setting shift to 2 and lim to 1. [ 0.002794] cblist_init_generic: Setting shift to 2 and lim to 1. [ 0.002965] rcu: Hierarchical SRCU implementation. [ 0.004261] EFI services will not be available. [ 0.004620] smp: Bringing up secondary CPUs ... [ 0.005158] Detected VIPT I-cache on CPU1 [ 0.005243] CPU1: Booted secondary processor 0x0000000001 [0x410fd034] [ 0.005923] Detected VIPT I-cache on CPU2 [ 0.005995] CPU2: Booted secondary processor 0x0000000002 [0x410fd034] [ 0.006627] Detected VIPT I-cache on CPU3 [ 0.006696] CPU3: Booted secondary processor 0x0000000003 [0x410fd034] [ 0.006790] smp: Brought up 1 node, 4 CPUs [ 0.006798] SMP: Total of 4 processors activated. [ 0.006802] CPU features: detected: 32-bit EL0 Support [ 0.006806] CPU features: detected: CRC32 instructions [ 0.007163] CPU: All CPU(s) started at EL2 [ 0.007182] alternatives: patching kernel code [ 0.008730] devtmpfs: initialized [ 0.012355] KASLR disabled due to lack of seed [ 0.012584] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.012605] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) [ 0.014003] pinctrl core: initialized pinctrl subsystem [ 0.015167] DMI not present or invalid. [ 0.016034] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 0.017612] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations [ 0.017939] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations [ 0.018106] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations [ 0.018212] audit: initializing netlink subsys (disabled) [ 0.018467] audit: type=2000 audit(0.016:1): state=initialized audit_enabled=0 res=1 [ 0.019563] thermal_sys: Registered thermal governor 'step_wise' [ 0.019574] thermal_sys: Registered thermal governor 'power_allocator' [ 0.019703] cpuidle: using governor menu [ 0.020054] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers. [ 0.020231] ASID allocator initialised with 65536 entries [ 0.020241] HugeTLB: can optimize 4095 vmemmap pages for hugepages-1048576kB [ 0.020247] HugeTLB: can optimize 127 vmemmap pages for hugepages-32768kB [ 0.020252] HugeTLB: can optimize 7 vmemmap pages for hugepages-2048kB [ 0.020256] HugeTLB: can optimize 0 vmemmap pages for hugepages-64kB [ 0.021930] Serial: AMBA PL011 UART driver [ 0.029582] platform 7000000.rtc: Fixing up cyclic dependency with 3001000.clock [ 0.030090] platform 7010000.clock: Fixing up cyclic dependency with 7000000.rtc [ 0.044690] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages [ 0.044705] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages [ 0.044711] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages [ 0.044716] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages [ 0.046360] ACPI: Interpreter disabled. [ 0.049195] iommu: Default domain type: Translated [ 0.049210] iommu: DMA domain TLB invalidation policy: strict mode [ 0.049572] SCSI subsystem initialized [ 0.049784] libata version 3.00 loaded. [ 0.050061] usbcore: registered new interface driver usbfs [ 0.050102] usbcore: registered new interface driver hub [ 0.050137] usbcore: registered new device driver usb [ 0.050867] pps_core: LinuxPPS API ver. 1 registered [ 0.050873] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.050892] PTP clock support registered [ 0.050996] EDAC MC: Ver: 3.0.0 [ 0.052387] FPGA manager framework [ 0.052558] Advanced Linux Sound Architecture Driver Initialized. [ 0.053492] vgaarb: loaded [ 0.054091] clocksource: Switched to clocksource arch_sys_counter [ 0.054373] VFS: Disk quotas dquot_6.6.0 [ 0.054422] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 0.054644] pnp: PnP ACPI: disabled [ 0.061916] NET: Registered PF_INET protocol family [ 0.062157] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear) [ 0.063320] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear) [ 0.063366] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear) [ 0.063497] TCP bind bhash tables hash table entries: 8192 (order: 5, 196608 bytes, linear) [ 0.063743] TCP: Hash tables configured (established 8192 bind 8192) [ 0.063914] UDP hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.063951] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear) [ 0.064165] NET: Registered PF_UNIX/PF_LOCAL protocol family [ 0.064703] RPC: Registered named UNIX socket transport module. [ 0.064715] RPC: Registered udp transport module. [ 0.064718] RPC: Registered tcp transport module. [ 0.064721] RPC: Registered tcp NFSv4.1 backchannel transport module. Starting syslogd[ 0.064732] PCI: CLS 0 bytes, default 64 : [ 0.065880] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available [ 0.067407] Initialise system trusted keyrings [ 0.067740] workingset: timestamp_bits=42 max_order=18 bucket_order=0 OK[ 0.075263] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.076086] NFS: Registering the id_resolver key type [ 0.076137] Key type id_resolver registered [ 0.076141] Key type id_legacy registered Starting klogd: [ 0.076225] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.076231] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering... OK [ 0.076456] 9p: Installing v9fs 9p2000 file system support [ 0.119607] Key type asymmetric registered [ 0.119618] Asymmetric key parser 'x509' registered Running sysctl: [ 0.119691] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245) [ 0.119698] io scheduler mq-deadline registered [ 0.119702] io scheduler kyber registered [ 0.129824] EINJ: ACPI disabled. OK[ 0.149674] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 0.153025] SuperH (H)SCI(F) driver initialized [ 0.153497] msm_serial: driver initialized Starting mdev...[ 0.155231] cacheinfo: Unable to detect cache hierarchy for CPU 0 [ 0.161996] loop: module loaded OK[ 0.163289] megasas: 07.719.03.00-rc1 [ 0.169894] tun: Universal TUN/TAP device driver, 1.6 [ 0.171057] thunder_xcv, ver 1.0 [ 0.171110] thunder_bgx, ver 1.0 [ 0.171163] nicpf, ver 1.0 [ 0.172488] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version [ 0.172496] hns3: Copyright (c) 2017 Huawei Corporation. [ 0.172585] hclge is initializing [ 0.172609] e1000: Intel(R) PRO/1000 Network Driver [ 0.172613] e1000: Copyright (c) 1999-2006 Intel Corporation. [ 0.172656] e1000e: Intel(R) PRO/1000 Network Driver [ 0.172659] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. [ 0.172699] igb: Intel(R) Gigabit Ethernet Network Driver [ 0.172702] igb: Copyright (c) 2007-2014 Intel Corporation. [ 0.172737] igbvf: Intel(R) Gigabit Virtual Function Network Driver [ 0.172740] igbvf: Copyright (c) 2009 - 2012 Intel Corporation. [ 0.173131] sky2: driver version 1.30 [ 0.174339] VFIO - User Level meta-driver version: 0.3 [ 0.176796] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver [ 0.176810] ehci-pci: EHCI PCI platform driver [ 0.176868] ehci-platform: EHCI generic platform driver [ 0.177001] ehci-orion: EHCI orion driver [ 0.177118] ehci-exynos: EHCI Exynos driver [ 0.177215] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver [ 0.177252] ohci-pci: OHCI PCI platform driver [ 0.177309] ohci-platform: OHCI generic platform driver [ 0.177430] ohci-exynos: OHCI Exynos driver [ 0.177989] usbcore: registered new interface driver usb-storage [ 0.181279] i2c_dev: i2c /dev entries driver [ 0.189068] sdhci: Secure Digital Host Controller Interface driver [ 0.189082] sdhci: Copyright(c) Pierre Ossman [ 0.189877] Synopsys Designware Multimedia Card Interface Driver [ 0.191189] sdhci-pltfm: SDHCI platform and OF driver helper [ 0.193497] ledtrig-cpu: registered to indicate activity on CPUs [ 0.195785] SMCCC: SOC_ID: ID = jep106:091e:1823 Revision = 0x00000000 [ 0.196728] usbcore: registered new interface driver usbhid [ 0.196738] usbhid: USB HID core driver [ 0.204363] NET: Registered PF_PACKET protocol family [ 0.204548] 9pnet: Installing 9P2000 support [ 0.204622] Key type dns_resolver registered [ 0.205231] registered taskstats version 1 [ 0.205255] Loading compiled-in X.509 certificates [ 0.229952] sun6i-rtc 7000000.rtc: registered as rtc0 [ 0.229992] sun6i-rtc 7000000.rtc: setting system clock to 1970-01-02T01:00:55 UTC (90055) [ 0.230669] sun6i-rtc 7000000.rtc: RTC enabled [ 0.251225] sun50i-h616-pinctrl 300b000.pinctrl: initialized sunXi PIO driver [ 0.252741] sun50i-h616-r-pinctrl 7022000.pinctrl: initialized sunXi PIO driver [ 0.255230] printk: console [ttyS0] disabled [ 0.275633] 5000000.serial: ttyS0 at MMIO 0x5000000 (irq = 283, base_baud = 1500000) is a 16550A [ 0.275860] printk: console [ttyS0] printing thread started [ 0.275885] printk: console [ttyS0] enabled [ 0.278807] sun6i-spi 5010000.spi: Failed to request TX DMA channel [ 0.278825] sun6i-spi 5010000.spi: Failed to request RX DMA channel [ 0.279672] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff [ 0.289313] sunxi-mmc 4020000.mmc: Got CD GPIO [ 0.292181] sunxi-mmc 4021000.mmc: allocated mmc-pwrseq [ 0.292272] sun50i-h616-r-pinctrl 7022000.pinctrl: supply vcc-pl not found, using dummy regulator [ 0.292656] sunxi-rsb 7083000.rsb: RSB running at 3000000 Hz [ 0.292847] sunxi-rsb 7083000.rsb: /soc/rsb@7083000/pmic@745: set runtime address failed: -22 [ 0.293011] axp20x-rsb sunxi-rsb-745: AXP20x variant AXP806 found [ 0.293908] axp20x-regulator axp20x-regulator.1: Error setting dcdc frequency: -5 [ 0.294060] vdd-cpu: failed to get the current voltage: -EIO [ 0.294112] axp20x-regulator axp20x-regulator.1: Failed to register dcdca [ 0.294118] axp20x-regulator: probe of axp20x-regulator.1 failed with error -5 [ 0.294520] axp20x-rsb sunxi-rsb-745: AXP20X driver loaded [ 0.295500] ALSA device list: [ 0.295514] No soundcards found. [ 0.314372] sunxi-mmc 4020000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 0.364732] mmc0: host does not support reading read-only switch, assuming write-enable [ 0.368126] mmc0: new high speed SDHC card at address aaaa [ 0.369015] mmcblk0: mmc0:aaaa SL32G 28.8 GiB [ 0.371681] mmcblk0: p1 p2 [ 0.522656] sunxi-mmc 4021000.mmc: initialized, max. request size: 16384 KB, uses new timings mode [ 0.528860] sunxi-mmc 4021000.mmc: card claims to support voltages below defined range [ 0.535716] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Quota mode: none. [ 0.535815] VFS: Mounted root (ext4 filesystem) on device 179:2. [ 0.537777] devtmpfs: mounted [ 0.539706] mmc1: new high speed SDIO card at address 0001 [ 0.540981] Freeing unused kernel memory: 6912K [ 0.642146] Run /sbin/init as init process [ 0.642157] with arguments: [ 0.642159] /sbin/init [ 0.642161] with environment: [ 0.642163] HOME=/ [ 0.642165] TERM=linux [ 0.991510] EXT4-fs (mmcblk0p2): re-mounted. Quota mode: none. [ 1.792288] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 1.792309] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found [ 1.927520] sunxi-wdt 30090a0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0) [ 1.931104] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 1.931124] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found [ 1.978799] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 1.993547] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 1.993783] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 [ 1.993809] cfg80211: failed to load regulatory.db [ 2.332323] dwmac-sun8i 5020000.ethernet: IRQ eth_wake_irq not found [ 2.332347] dwmac-sun8i 5020000.ethernet: IRQ eth_lpi not found Initializing random number generator: OK Saving random seed: [ 3.998094] random: crng init done OK Starting system message bus: done Starting network: OK Starting WiFi: Successfully initialized wpa_supplicant udhcpc: started, v1.35.0 udhcpc: broadcasting discover udhcpc: broadcasting discover udhcpc: broadcasting select for 192.168.10.196, server 192.168.10.251 udhcpc: lease of 192.168.10.196 obtained from 192.168.10.251, lease time 43200 deleting routers adding dns 192.168.10.251 OK Starting sshd: [ 8.070171] NET: Registered PF_INET6 protocol family [ 8.071640] Segment Routing with IPv6 [ 8.071670] In-situ OAM (IOAM) with IPv6 OK Welcome to Buildroot buildroot login: root Password: [root@buildroot]:~$ lsmod Module Size Used by ipv6 462848 18 8723ds 1466368 0 cfg80211 380928 1 8723ds rfkill 36864 2 cfg80211 sunxi_wdt 20480 0 dwmac_sun8i 28672 0 stmmac_platform 20480 1 dwmac_sun8i stmmac 221184 2 dwmac_sun8i,stmmac_platform pcs_xpcs 24576 1 stmmac crct10dif_ce 20480 1 [root@buildroot]:~$ ifconfig 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) wlan0 Link encap:Ethernet HWaddr 94:A4:08:D8:1C:EC inet addr:192.168.10.196 Bcast:192.168.10.255 Mask:255.255.255.0 inet6 addr: fe80::96a4:8ff:fed8:1cec/64 Scope:Link inet6 addr: fd15:3be5:c6ac:0:96a4:8ff:fed8:1cec/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:26 errors:0 dropped:9 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3949 (3.8 KiB) TX bytes:2116 (2.0 KiB) [root@buildroot]:~$ uname -a Linux buildroot 5.19.0-rc1-609706-gc465e81f8859-dirty #1 SMP PREEMPT Mon Sep 5 23:37:32 CST 2022 aarch64 GNU/Linux [root@buildroot]:~$ df -h Filesystem Size Used Available Use% Mounted on /dev/root 28.0G 93.7M 26.5G 0% / devtmpfs 468.5M 0 468.5M 0% /dev tmpfs 487.9M 0 487.9M 0% /dev/shm tmpfs 487.9M 36.0K 487.8M 0% /tmp tmpfs 487.9M 28.0K 487.8M 0% /run [root@buildroot]:~$ free total used free shared buff/cache available Mem: 999156 30656 936852 64 31648 918856 Swap: 0 0 0 [root@buildroot]:~$
-
回复: T113奇怪的屏幕刷新问题
- 我将tin跟buildroot两个SDK内核文件取出进行对比:drivers/video/fbdev/sunxi/disp2/disp/dev_disp.c
- 对比后发现buildroot中的__disp_ion_alloc_coherent函数使用ION_FLAG_CACHED标志进行内存分配
- 使用cache的情况下,数据写入到fb中会出现不及时的现象,关闭此标志就没这个问题了。