全志v3s学习笔记(6)——Bsp内核编译与烧录

如果不想被坑卓坑, 又想比较好地使用摄像头,可以使用主线Uboot加Bsp内核方案, 系统配置为fex文件配置。
主线uboot: https://github.com/Lichee-Pi/u-boot
bsp内核: http://pan.baidu.com/s/1eRJrViy

一、安装交叉编译环境

交叉编译环境跟uboot使用的一样。
参考:arm-linux-gnueabihf 交叉编译工具链安装


二、下载bsp内核源码

bsp内核: http://pan.baidu.com/s/1eRJrViy
linux-3.4是bsp内核源码。


三、修改顶层Makefile

在内核根目录下的Makefile195行修改默认编译器,可以直接用make编译:

# ARCH		?= $(SUBARCH)
# CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH		?= arm
CROSS_COMPILE	?= arm-linux-gnueabihf-

四、编译

lichee_BSP_config配置修改了内核支持网口 支持ext4文件系统

cd linux-3.4
cp lichee_BSP_config .config
make uImage -j16
make -j16 INSTALL_MOD_PATH=out modules			# 编译出模块
make -j16 INSTALL_MOD_PATH=out modules_install	# 安装模块

uImagearch/arm/boot/uImage目录


五、TF卡烧录

准备好之前生成的boot.scrscript.bin
参考:u-boot传参(boot.scr)和参数配置(script.bin)文件

# 查询挂载名
df -h
# 拷贝到第一分区(32M卷)
cp uImage boot.scr script.bin /media/pjw/43EE-E439

在这里插入图片描述
在这里插入图片描述


六、输出LOG:

U-Boot SPL 2017.01-rc2-00057-g32ab1804cd-dirty (Feb 22 2021 - 13:37:47)
DRAM: 64 MiB
Trying to boot from MMC1

U-Boot 2017.01-rc2-00057-g32ab1804cd-dirty (Feb 22 2021 - 13:37:47 +0800) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
dotclock: 10000kHz = 10000kHz: (1 * 3MHz * 20) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000


U-Boot 2017.01-rc2-00057-g32ab1804cd-dirty (Feb 22 2021 - 13:37:47 +0800) Allwinner Technology

CPU:   Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM:  64 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 480x272 lcd console (overscan 0x0)
dotclock: 10000kHz = 10000kHz: (1 * 3MHz * 20) / 6
In:    serial@01c28000
Out:   serial@01c28000
Err:   serial@01c28000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
290 bytes read in 15 ms (18.6 KiB/s)
## Executing script at 41900000
reading uImage
2434040 bytes read in 133 ms (17.5 MiB/s)
reading script.bin
35280 bytes read in 26 ms (1.3 MiB/s)
## Booting kernel from Legacy Image at 41000000 ...
   Image Name:   Linux-3.4.39
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2433976 Bytes = 2.3 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
Using machid 0x1029 from environment

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.4.39 (pjw@pjw-virtual-machine) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #11 Fri Feb 26 16:20:22 CST 2021
[    0.000000] Initialized persistent memory from 41d20800-41d307ff
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 earlyprintk rw
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 64MB = 64MB total
[    0.000000] Memory: 30404k/30404k available, 35132k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0476000   (4536 kB)
[    0.000000]       .init : 0xc0476000 - 0xc0499000   ( 140 kB)
[    0.000000]       .data : 0xc049a000 - 0xc04de7b0   ( 274 kB)
[    0.000000]        .bss : 0xc04de7d4 - 0xc05793d4   ( 619 kB)
[    0.000000] NR_IRQS:544
[    0.000000] Architected local timer running at 24.00MHz.
[    0.000000] Switching to timer-based delay loop
[    0.000000] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
[    0.000000] Console: colour dummy device 80x30
[    0.000154] Calibrating delay loop (skipped), value calculated using timer frequency.. 4800.00 BogoMIPS (lpj=24000000)
[    0.000174] pid_max: default: 32768 minimum: 301
[    0.000312] Mount-cache hash table entries: 512
[    0.000844] CPU: Testing write buffer coherency: ok
[    0.001100] Setting up static identity map for 0x40351820 - 0x40351878
[    0.001760] devtmpfs: initialized
[    0.003404] pinctrl core: initialized pinctrl subsystem
[    0.003885] NET: Registered protocol family 16
[    0.004190] DMA: preallocated 128 KiB pool for atomic coherent allocations
[    0.004248] script_sysfs_init success
[    0.004992] gpiochip_add: registered GPIOs 0 to 223 on device: sunxi-pinctrl
[    0.005769] sunxi-pinctrl sunxi-pinctrl: initialized sunXi PIO driver
[    0.006131] gpiochip_add: registered GPIOs 1024 to 1031 on device: axp-pinctrl
[    0.006876] persistent_ram: found existing buffer, size 18599, start 18599
[    0.090015] console [ram-1] enabled
[    0.090957] Not Found clk pll_isp in script 
[    0.091100] Not Found clk pll_video in script 
[    0.091235] Not Found clk pll_ve in script 
[    0.091479] Not Found clk pll_periph0 in script 
[    0.091611] Not Found clk pll_de in script 
[    0.095614] bio: create slab <bio-0> at 0
[    0.096017] pwm module init!
[    0.098218] SCSI subsystem initialized
[    0.098599] usbcore: registered new interface driver usbfs
[    0.098915] usbcore: registered new interface driver hub
[    0.099177] usbcore: registered new device driver usb
[    0.099547] twi_chan_cfg()340 - [twi0] has no twi_regulator.
[    0.099688] twi_chan_cfg()340 - [twi1] has no twi_regulator.
[    0.100644] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x34)
[    0.100909] axp20_board 0-0034: failed reading at 0x03
[    0.101073] axp20_board: probe of 0-0034 failed with error -70
[    0.101365] Linux video capture interface: v2.00
[    0.101585] gpiochip_add: gpios 1024..1028 (axp_pin) failed to register
[    0.102164] Advanced Linux Sound Architecture Driver Version 1.0.25.
[    0.102974] Switching to clocksource arch_sys_counter
[    0.110000] NET: Registered protocol family 2
[    0.110000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.110205] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.110470] TCP: Hash tables configured (established 2048 bind 2048)
[    0.110605] TCP: reno registered
[    0.110855] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.111003] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.111526] NET: Registered protocol family 1
[    0.111986] standby_mode = 1. 
[    0.112123] wakeup src cnt is : 3. 
[    0.112386] pmu1_enable = 0x1. 
[    0.112519] pmux_id = 0x1. 
[    0.112661] config_pmux_para: script_parser_fetch err. 
[    0.112904] pmu2_enable = 0x0. 
[    0.113039] add_sys_pwr_dm: get ldo name failed
[    0.113170] add_sys_pwr_dm: get ldo name failed
[    0.113414] add_sys_pwr_dm: get ldo name failed
[    0.113547] add_sys_pwr_dm: get ldo name failed
[    0.113680] add_sys_pwr_dm: get ldo name failed
[    0.113925] add_sys_pwr_dm: get ldo name failed
[    0.114058] add_sys_pwr_dm: get ldo name failed
[    0.114304] add_sys_pwr_dm: get ldo name failed
[    0.114438] add_sys_pwr_dm: get ldo name failed
[    0.114571] add_sys_pwr_dm: get ldo name failed
[    0.114815] after inited: sys_mask config = 0x0. 
[    0.114949] dynamic_standby enalbe = 0x0. 
[    0.115243] sunxi_reg_init enter
[    0.117292] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.117486] jffs2: version 2.2. (NAND) (SUMMARY)  漏 2001-2006 Red Hat, Inc.
[    0.117925] msgmni has been set to 59
[    0.118998] io scheduler noop registered
[    0.119254] io scheduler deadline registered
[    0.119468] io scheduler cfq registered (default)
[    0.119997] [DISP]disp_module_init
[    0.120701] cmdline,disp=
[    0.121039] [DISP] disp_get_rotation_sw,line:68:disp 0 out of range? g_rot_sw=0
[    0.121419] [DISP] disp_init_connections,line:289:NULL pointer: 0, 0
[    0.121753] [DISP] display_fb_request,line:1142:invalid paras xres(0), yres(0) bpp(16) 
[    0.123942] [DISP]disp_module_init finish
[    0.124340] sw_uart_get_devinfo()1503 - uart0 has no uart_regulator.
[    0.124941] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
[    0.125088] sw_uart_pm()890 - uart0 clk is already enable
[    0.125346] sw_console_setup()1233 - console setup baud 115200 parity n bits 8, flow n
[    0.238829] console [ttyS0] enabled
[    0.749935] sunxi_spi_chan_cfg()1376 - [spi-0] has no spi_regulator.
[    0.757824] spi spi0: master is unqueued, this is deprecated
[    0.765877] Failed to alloc md5
[    0.769540] eth0: Use random mac address
[    0.774239] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.801716] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.810872] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1
[    0.819638] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000
[    0.840040] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00
[    0.847523] hub 1-0:1.0: USB hub found
[    0.851872] hub 1-0:1.0: 1 port detected
[    0.856753] sunxi-ehci sunxi-ehci.1: remove, state 1
[    0.862541] usb usb1: USB disconnect, device number 1
[    0.869419] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[    0.885971] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.913045] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    0.921812] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 1
[    0.930493] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400
[    0.994600] hub 1-0:1.0: USB hub found
[    0.998909] hub 1-0:1.0: 1 port detected
[    1.003903] sunxi-ohci sunxi-ohci.1: remove, state 1
[    1.009555] usb usb1: USB disconnect, device number 1
[    1.015962] sunxi-ohci sunxi-ohci.1: USB bus 1 deregistered
[    1.032384] Initializing USB Mass Storage driver...
[    1.038097] usbcore: registered new interface driver usb-storage
[    1.044911] USB Mass Storage support registered.
[    1.050607] file system registered
[    1.056077] android_usb gadget: Mass Storage Function, version: 2009/09/11
[    1.063895] android_usb gadget: Number of LUNs=1
[    1.069253]  lun0: LUN: removable file: (no medium)
[    1.075240] android_usb gadget: android_usb ready
[    1.080853] sunxikbd_script_init: key para not found, used default para. 
[    1.089456] sunxi-rtc sunxi-rtc: rtc core: registered sunxi-rtc as rtc0
[    1.097974] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.106873] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.115846] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.124610] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.133377] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.142016] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.150766] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.159793] sunxi_wdt_init_module: sunxi WatchDog Timer Driver v1.0
[    1.167049] sunxi_wdt_probe: devm_ioremap return wdt_reg 0xf1c20ca0, res->start 0x01c20ca0, res->end 0x01c20cbf
[    1.178506] sunxi_wdt_probe: initialized (g_timeout=16s, g_nowayout=0)
[    1.186333] wdt_enable, write reg 0xf1c20cb8 val 0x00000000
[    1.192651] wdt_set_tmout, write 0x000000b0 to mode reg 0xf1c20cb8, actual timeout 16 sec
[    1.204584] no led_3, ignore it!
[    1.208322] no led_4, ignore it!
[    1.212060] no led_5, ignore it!
[    1.215871] no led_6, ignore it!
[    1.219570] no led_7, ignore it!
[    1.225255] usbcore: registered new interface driver usbhid
[    1.231728] usbhid: USB HID core driver
[    1.236778] ashmem: initialized
[    1.240800] logger: created 256K log 'log_main'
[    1.246196] logger: created 32K log 'log_events'
[    1.251596] logger: created 32K log 'log_radio'
[    1.256965] logger: created 32K log 'log_system'
[    1.263790] script_get_item return type err, consider it no ldo
[    1.274919] asoc: sndcodec <-> sunxi-codec mapping ok
[    1.280834] *******************Try sdio*******************
[    1.289091] TCP: cubic registered
[    1.293123] NET: Registered protocol family 17
[    1.298337] VFP support v0.3: [mmc]: *** sunxi_mci_dump_errinfo(L826): smc 0 err, cmd 5,  RTO !!
[    1.308629] ThumbEE CPU extension supported.
[    1.313522] *******************Try sd *******************
[    1.319762] Registering SWP/SWPB emulation handler
[    1.326163] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.335348] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.345270] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.356132] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.364850] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.373441] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.382219] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.391141] sunxi-rtc sunxi-rtc: setting system clock to 1970-01-01 00:00:15 UTC (15)
[    1.401602] ALSA device list:
[    1.405071]   #0: audiocodec
[    1.408987] Waiting for root device /dev/mmcblk0p2...
[    1.416117] mmc0: new high speed SDHC card at address b368
[    1.422801] mmcblk0: mmc0:b368 NCard 29.1 GiB 
[    1.429420]  mmcblk0: p1 p2
[    1.433574] mmcblk mmc0:b368: Card claimed for testing.
[    1.439519] mmc0:b368: NCard 29.1 GiB 
[    1.443958] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.452844] *******************sd init ok*******************
[    1.459429] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.468206] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.476889] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.485564] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.494131] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.502809] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.521184] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[    1.531350] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
[    1.541544] EXT4-fs (mmcblk0p2): couldn't mount RDWR because of unsupported optional features (400)
[    1.557801] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)
[    1.567448] Backtrace: 
[    1.570447] [<c00132b0>] (dump_backtrace+0x0/0x104) from [<c034bc58>] (dump_stack+0x18/0x1c)
[    1.580057]  r7:c04a2814 r6:c183d024 r5:c04df9f0 r4:c183d024
[    1.586980] [<c034bc40>] (dump_stack+0x0/0x1c) from [<c034c024>] (panic+0x78/0x1bc)
[    1.595731] [<c034bfac>] (panic+0x0/0x1bc) from [<c0476d4c>] (mount_block_root+0x248/0x280)
[    1.605239]  r3:00000000 r2:80000000 r1:c1821f48 r0:c03fbdfe
[    1.612158]  r7:c04a2814
[    1.615221] [<c0476b04>] (mount_block_root+0x0/0x280) from [<c0476ddc>] (mount_root+0x58/0x6c)
[    1.625027] [<c0476d84>] (mount_root+0x0/0x6c) from [<c0476f20>] (prepare_namespace+0x130/0x190)
[    1.635018]  r5:c0493dd8 r4:c04de864
[    1.639368] [<c0476df0>] (prepare_namespace+0x0/0x190) from [<c047696c>] (kernel_init+0x170/0x1b0)
[    1.649551]  r5:00000096 r4:00000008
[    1.653905] [<c04767fc>] (kernel_init+0x0/0x1b0) from [<c0031df8>] (do_exit+0x0/0x624)
[    1.662931]  r7:00000013
[    1.665994] Rebooting in 5 seconds..
[    6.670357] Restarting Linux version 3.4.39 (pjw@pjw-virtual-machine) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #11 Fri Feb 26 16:20:22 CST 2021

参考:
licheepi zero BSP 内核(linux3.4) 编译教程
BSP内核的完整包(含u-boot、BSP内核、buildroot、.config、sunxi-tools、lrzsz)

猜你喜欢

转载自blog.csdn.net/p1279030826/article/details/113870839
今日推荐