题,上周六买的OrangePi zero plus2刚到,尝试了一下OrangePi给的系统后,决定自己去编译一下,然后就想用最新的u-boot和Linux kernel版本,于是下载了u-boot-2019.10的源码和linux kernel 5.3.6的源码,然后尝试编译,然后用busybox编译了文件系统,最终u-boot应该是可以正常启动了,但是引导内核,无法进入文件系统(描述或许不准确)。
由于之前没太接触过这方面的知识,对整个的流程或者步骤也不是很清楚,所以可能有些描述不正确,下面我贴一下具体的log和关键信息:
u-boot 启动截图:
u-boot 环境变量:
图片太大,有可能看不清楚,我将bootcmd和bootargs单独截图出来;
然后是kerenl启动log:
16906752 bytes read in 1256 ms (12.8 MiB/s)
17988 bytes read in 3 ms (5.7 MiB/s)
## Flattened Device Tree blob at 49000000
Booting using the fdt blob at 0x49000000
Loading Device Tree to 0000000049ff8000, end 0000000049fff643 ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.3.6 (imliubo@makingfunxyz) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) #1 SMP PREEMPT Sun Oct 13 17:27:31 CST 2019
[ 0.000000] Machine model: OrangePi Zero Plus2
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 32 MiB at 0x000000005e000000
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0x5dee4840-0x5dee5fff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000005fffffff]
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv0.2 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: Trusted OS migration not required
[ 0.000000] percpu: Embedded 22 pages/cpu s52184 r8192 d29736 u90112
[ 0.000000] Detected VIPT I-cache on CPU0
[ 0.000000] CPU features: detected: ARM erratum 845719
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129024
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootwait
[ 0.000000] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 454768K/524288K available (10044K kernel code, 766K rwdata, 3548K rodata, 2112K init, 411K bss, 36752K reserved, 32768K cma-reserved)
[ 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 restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[ 0.000000] 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] GIC: Using split EOI/Deactivate mode
[ 0.000000] random: get_random_bytes called from start_kernel+0x300/0x4a0 with crng_init=0
[ 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.000009] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.000224] Console: colour dummy device 80x25
[ 0.000360] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=96000)
[ 0.000384] pid_max: default: 32768 minimum: 301
[ 0.000572] LSM: Security Framework initializing
[ 0.000697] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000724] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.024065] ASID allocator initialised with 32768 entries
[ 0.032052] rcu: Hierarchical SRCU implementation.
[ 0.040392] EFI services will not be available.
[ 0.048126] smp: Bringing up secondary CPUs ...
[ 0.081166] Detected VIPT I-cache on CPU1
[ 0.081262] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[ 0.112878] Detected VIPT I-cache on CPU2
[ 0.112944] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[ 0.144991] Detected VIPT I-cache on CPU3
[ 0.145051] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[ 0.145206] smp: Brought up 1 node, 4 CPUs
[ 0.145246] SMP: Total of 4 processors activated.
[ 0.145261] CPU features: detected: 32-bit EL0 Support
[ 0.145276] CPU features: detected: CRC32 instructions
[ 0.146366] CPU: All CPU(s) started at EL2
[ 0.146414] alternatives: patching kernel code
[ 0.148892] devtmpfs: initialized
[ 0.157061] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.157100] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[ 0.159966] pinctrl core: initialized pinctrl subsystem
[ 0.160372] DMI not present or invalid.
[ 0.161002] NET: Registered protocol family 16
[ 0.161765] audit: initializing netlink subsys (disabled)
[ 0.162121] audit: type=2000 audit(0.160:1): state=initialized audit_enabled=0 res=1
[ 0.163348] cpuidle: using governor menu
[ 0.163795] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[ 0.167349] DMA: preallocated 256 KiB pool for atomic allocations
[ 0.167613] Serial: AMBA PL011 UART driver
[ 0.194885] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[ 0.194910] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[ 0.194926] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[ 0.194942] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[ 0.199205] cryptd: max_cpu_qlen set to 1000
[ 0.206841] ACPI: Interpreter disabled.
[ 0.207755] vgaarb: loaded
[ 0.208437] SCSI subsystem initialized
[ 0.209316] usbcore: registered new interface driver usbfs
[ 0.209404] usbcore: registered new interface driver hub
[ 0.209548] usbcore: registered new device driver usb
[ 0.209999] pps_core: LinuxPPS API ver. 1 registered
[ 0.210012] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.210049] PTP clock support registered
[ 0.210107] EDAC MC: Ver: 3.0.0
[ 0.211147] FPGA manager framework
[ 0.211319] Advanced Linux Sound Architecture Driver Initialized.
[ 0.212640] clocksource: Switched to clocksource arch_sys_counter
[ 0.212965] VFS: Disk quotas dquot_6.6.0
[ 0.213083] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.213531] pnp: PnP ACPI: disabled
[ 0.225668] thermal_sys: Registered thermal governor 'step_wise'
[ 0.225678] thermal_sys: Registered thermal governor 'power_allocator'
[ 0.226158] NET: Registered protocol family 2
[ 0.226928] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 0.226976] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.227076] TCP bind hash table entries: 4096 (order: 4, 65536 bytes, linear)
[ 0.227225] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.227404] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.227453] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.227713] NET: Registered protocol family 1
[ 0.228681] RPC: Registered named UNIX socket transport module.
[ 0.228696] RPC: Registered udp transport module.
[ 0.228707] RPC: Registered tcp transport module.
[ 0.228718] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.228742] PCI: CLS 0 bytes, default 64
[ 0.230055] kvm [1]: IPA Size Limit: 40bits
[ 0.231192] kvm [1]: vgic interrupt IRQ1
[ 0.231425] kvm [1]: Hyp mode initialized successfully
[ 0.245197] Initialise system trusted keyrings
[ 0.245483] workingset: timestamp_bits=44 max_order=17 bucket_order=0
[ 0.261060] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.262682] NFS: Registering the id_resolver key type
[ 0.262730] Key type id_resolver registered
[ 0.262743] Key type id_legacy registered
[ 0.262769] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.263089] 9p: Installing v9fs 9p2000 file system support
[ 0.302178] Key type asymmetric registered
[ 0.302195] Asymmetric key parser 'x509' registered
[ 0.302279] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[ 0.302295] io scheduler mq-deadline registered
[ 0.302306] io scheduler kyber registered
[ 0.307246] sun8i-h3-r-pinctrl 1f02c00.pinctrl: initialized sunXi PIO driver
[ 0.314463] sun50i-h5-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.317004] EINJ: ACPI disabled.
[ 0.327058] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.330107] printk: console [ttyS0] disabled
[ 0.350830] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 17, base_baud = 1500000) is a U6_16550A
[ 1.113214] printk: console [ttyS0] enabled
[ 1.139336] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 18, base_baud = 1500000) is a U6_16550A
[ 1.150610] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 1.171690] loop: module loaded
[ 1.179220] libphy: Fixed MDIO Bus: probed
[ 1.183986] tun: Universal TUN/TAP device driver, 1.6
[ 1.190027] thunder_xcv, ver 1.0
[ 1.193376] thunder_bgx, ver 1.0
[ 1.196702] nicpf, ver 1.0
[ 1.200113] hclge is initializing
[ 1.203456] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[ 1.210692] hns3: Copyright (c) 2017 Huawei Corporation.
[ 1.216114] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[ 1.221964] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[ 1.227985] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[ 1.234962] igb: Copyright (c) 2007-2014 Intel Corporation.
[ 1.240648] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[ 1.248492] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[ 1.254512] sky2: driver version 1.30
[ 1.258793] VFIO - User Level meta-driver version: 0.3
[ 1.266044] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.272599] ehci-pci: EHCI PCI platform driver
[ 1.277127] ehci-platform: EHCI generic platform driver
[ 1.282563] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.288785] ohci-pci: OHCI PCI platform driver
[ 1.293323] ohci-platform: OHCI generic platform driver
[ 1.299274] usbcore: registered new interface driver usb-storage
[ 1.308800] sun6i-rtc 1f00000.rtc: registered as rtc0
[ 1.313889] sun6i-rtc 1f00000.rtc: RTC enabled
[ 1.318521] i2c /dev entries driver
[ 1.324166] sdhci: Secure Digital Host Controller Interface driver
[ 1.330374] sdhci: Copyright(c) Pierre Ossman
[ 1.334995] Synopsys Designware Multimedia Card Interface Driver
[ 1.342883] sunxi-mmc 1c0f000.mmc: Got CD GPIO
[ 1.373093] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB, uses new timings mode
[ 1.383167] sunxi-mmc 1c10000.mmc: allocated mmc-pwrseq
[ 1.404105] sunxi-mmc 1c0f000.mmc: no support for card's volts
[ 1.409981] mmc0: error -22 whilst initialising SD card
[ 1.621278] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB, uses new timings mode
[ 1.640449] sunxi-mmc 1c10000.mmc: no support for card's volts
[ 1.646334] mmc1: error -22 whilst initialising SDIO card
[ 1.658936] sunxi-mmc 1c11000.mmc: initialized, max. request size: 2048 KB, uses new timings mode
[ 1.668510] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.675432] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.682942] usbcore: registered new interface driver usbhid
[ 1.688573] usbhid: USB HID core driver
[ 1.695722] NET: Registered protocol family 17
[ 1.700575] 9pnet: Installing 9P2000 support
[ 1.705010] Key type dns_resolver registered
[ 1.710487] registered taskstats version 1
[ 1.714666] Loading compiled-in X.509 certificates
[ 1.735993] sun6i-rtc 1f00000.rtc: setting system clock to 1970-01-01T01:08:13 UTC (4093)
[ 1.744706] ALSA device list:
[ 1.747680] No soundcards found.
[ 1.749298] sunxi-mmc 1c11000.mmc: no support for card's volts
[ 1.756957] mmc2: error -22 whilst initialising MMC card
[ 1.762813] Waiting for root device /dev/mmcblk0p2...
然后就一直卡在 Waiting for root device /dev/mmcblk0p2... 这了,不知道是什么原因,然后上一句mmc2: error -2,通过mmc list来看应该对应的是AP6212网卡,应该是没有驱动,所以没法识别,不晓得是不是这个原因:
SD卡fat16分区和ext4分区的文件如下:
请大神帮忙给看看,是我一开始就做的不对,还是某一步配置有错误,因为对整个流程还没太搞明白。。。
如果缺少关键信息,可以提示我,然后我增加。
先谢谢大家了。
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
可以进入 u-boot 命令行吗?
可以 u-boot 命令都可以用
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
看下你的linux设备树(dts文件) 启用了哪些 mmc ?
mmc0 & mmc2 ?
这个需要晚上回去看一下。。。 如果是mmc2的错误,可以屏蔽掉嘛?
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
[ 1.409981] mmc0: error -22 whilst initialising SD card
[ 1.646334] mmc1: error -22 whilst initialising SDIO card
[ 1.756957] mmc2: error -22 whilst initialising MMC cardmmc0,mmc1, mmc2 均初始化出错了
很可能是配置问题了, 因为能启动到这里硬件问题不会太大。
那该怎么去配置? 编译kernel的时候 menuconfig里配置吗?
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
重点检查一下 mmc0 的设备树配置
谢谢晕哥,刚换了关键词搜索了一下,发现一个相似的文章,晚上回去尝试一下:
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
坐等楼主更新进度条了...
实在是更新不了 昨晚看了一下 看不懂 还没学明白呢。。。。
好难呀 没有方向 无从下手。。。
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
你用的是哪个 dtb 文件, 通过这个文件找对应的 dts 文件, 然后找到 mmc0 那个部分就可以。
晚上好,晕哥,昨天晚上找了,主要是对设备文件的语法不懂,还有就是Orange Pi 仓库zero plus2的设备树文件有点乱,不晓得具体对应哪一个:
https://github.com/orangepi-xunlong/OrangePiH5_kernel/tree/master/arch/arm64/boot/OrangePiH5_Zero_Plus2_dts
就比如上面链接中有很多个,不晓得用哪一个。
然后还从这个仓库中发现了这个文件,与我编译的主线linux kernel中的不一样:
https://github.com/orangepi-xunlong/mainline_kernel/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
下面是主线linux kernel中的设备树文件:
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
可以看出两个文件关于mmc0部分确实不一样,原本以为直接替换编译就可以,但是提示两个管脚找不到,这就真不知道从什么地方去定义了。。。。
这个地方在主线linux kernel中的设备树文件中是没有定义的。
所以就不晓得咋修改了。。。。 第一次接触设备树,之前只是听说过。
最近编辑记录 IAMLIUBO (2019-10-15 23:56:48)
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
那一楼运行的固件是你自己编译的吗?那你烧录的是哪个 dtb 文件呢?
是自己编译的,使用的是编译后在主线arch/arm64/boot/dts/allwinner/文件下的sun50i-h5-orangepi-zero-plus2.dtb这个,连同Image文件一块copy到了SD卡的第一个分区(FAT16),busybox打包的文件系统copy到了SD卡第二个分区(ext4)。
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
你从哪个目录拷贝的 dtb 文件, 就找那个目录的 dts 文件。
是的,我copy的是这个dtb文件:
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dtb
找到了这个对应的dts文件:
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
也找到了mmc0初始化部分,但是mmc0初始化失败,不晓得该怎么去修改,而且与这个dts文件不太一样:
https://github.com/orangepi-xunlong/mainline_kernel/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
这玩意还真是不简单。。。。。
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
啊哈哈哈哈哈 终于跑起来了 非常感谢晕哥的指点 真是不容易啊
明晚整理一下过程,从周六开始到现在,真是太难了。。。。。
再次感谢晕哥的指点!
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线
他来了,他来了,他带着视频走来了!
经过几天的努力视频终于搞完了,不得不说搞视频还是一个比较麻烦的工作!废话不多说,上链接!(话说怎么插入视频?)
以一个菜鸟的视角去学习如何编译属于你的镜像,有错误的话还请各位大神,在弹幕中批评指正。
https://www.bilibili.com/video/av73096039/
多谢晕哥的指导。
资料如何下载在视频下方有说明。
唯有爱与科技不可辜负。
知乎专栏:IAMLIUBO的神奇物联网之旅
博客园:IAMLIUBO
Gayhub: IAMLIUBO
离线