编译BSP系统参考: https://whycan.com/t_682.html
1. 编译uboot
2. 生成boot.scr文件
编写boot.cmd
setenv bootdelay 0
setenv bootargs "console=ttyS0,115200 panic=5 rootwait root=/dev/ram0 rdinit=/linuxrc earlyprintk rw"
setenv bootm_boot_mode sec
setenv machid 1029
bootm 0x41000000
制作:
tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr
3. 生成 script.bin文件
使用qianhao提供的sys_config.fex
fex2bin sys_config.fex > script.bin
4. 编译文件系统
使用https://buildroot.org/downloads/buildroot-2017.08.1.tar.gz
Toolchain
x x Toolchain type (External toolchain) ---> x x
x x *** Toolchain External Options *** x x
x x Toolchain (Custom toolchain) ---> x x
x x Toolchain origin (Pre-installed toolchain) ---> x x
x x (/opt/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf) Toolchain path
x x
x x (arm-linux-gnueabihf) Toolchain prefix x x
x x External toolchain gcc version (4.9.x) ---> x x
x x External toolchain kernel headers series (4.0.x) --->
x x
x x External toolchain C library (glibc/eglibc) ---> x x
Filesystem images 制作rootfs.cpio.gz
x x * cpio the root filesystem (for use as an initial RAM filesystem) x x
x x Compression method (gzip) --->
编译完成后,生成output/images/文件夹下的rootfs.cpio.gz
制作ramfs
mkimage -A arm -T ramdisk -C none -n uInitrd -d rootfs.cpio.gz rootfs.cpio.gz.uImage
5. 编译内核
cp lichee_BSP_config .config
配置内核
General setup --->
x x * Initial RAM filesystem and RAM disk (initramfs/initrd) support x x
x x (/home/osboxes/v3s/licheezero/rootfs/rootfs-bin) Initramfs source file(s)
x x (0) User ID to map to 0 (user root) x x
x x (0) Group ID to map to 0 (group root) x x
x x * Support initial ramdisks compressed using gzip x x
x x [ ] Support initial ramdisks compressed using bzip2 x x
x x [ ] Support initial ramdisks compressed using LZMA x x
x x [ ] Support initial ramdisks compressed using XZ x x
x x [ ] Support initial ramdisks compressed using LZO x x
x x Built-in initramfs compression mode (None) --->
其中/home/osboxes/v3s/licheezero/rootfs/rootfs-bin目录下存放制作好的rootfs.cpio.gz
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage -j8
上电进入FEL模式运行:
sunxi-fel.exe -p uboot u-boot-sunxi-with-spl.bin write 0x41000000 uImage write 0x41d00000 script.bin write 0x41e00000 boot.scr write 0x41A00000 rootfs.cpio.gz.uImage
系统启动后停在
[ 1.324816] Warning: unable to open an initial console.
[ 1.330947] Waiting for root device /dev/ram0...
输入回车没有反应。
U-Boot SPL 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39)
DRAM: 64 MiB
Trying to boot from FEL
U-Boot 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39 -0400) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
U-Boot 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39 -0400) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 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
(FEL boot)
## Executing script at 41e00000
## Booting kernel from Legacy Image at 41000000 ...
Image Name: Linux-3.4.39
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3939328 Bytes = 3.8 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 (osboxes@osboxes) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #24 Wed Apr 14 02:02:59 EDT 2021
[ 0.000000] Initialized persistent memory from 41d20800-41d307ff
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/ram0 rdinit=/linuxrc 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: 28932k/28932k available, 36604k 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 - 0xc0609000 (1612 kB)
[ 0.000000] .data : 0xc060a000 - 0xc064e7b0 ( 274 kB)
[ 0.000000] .bss : 0xc064e7d4 - 0xc06e93d4 ( 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.000164] Calibrating delay loop (skipped), value calculated using timer frequency.. 4800.00 BogoMIPS (lpj=24000000)
[ 0.000187] pid_max: default: 32768 minimum: 301
[ 0.000333] Mount-cache hash table entries: 512
[ 0.000885] CPU: Testing write buffer coherency: ok
[ 0.001153] Setting up static identity map for 0x40351820 - 0x40351878
[ 0.001815] devtmpfs: initialized
[ 0.003500] pinctrl core: initialized pinctrl subsystem
[ 0.003999] NET: Registered protocol family 16
[ 0.004326] DMA: preallocated 128 KiB pool for atomic coherent allocations
[ 0.004387] script_sysfs_init success
[ 0.005137] gpiochip_add: registered GPIOs 0 to 223 on device: sunxi-pinctrl
[ 0.006030] sunxi-pinctrl sunxi-pinctrl: initialized sunXi PIO driver
[ 0.006395] gpiochip_add: registered GPIOs 1024 to 1031 on device: axp-pinctrl
[ 0.007234] persistent_ram: uncorrectable error in header
[ 0.007251] persistent_ram: no valid data in buffer (sig = 0x42004000)
[ 0.014267] console [ram-1] enabled
[ 0.015084] Not Found clk pll_isp in script
[ 0.015231] Not Found clk pll_video in script
[ 0.015481] Not Found clk pll_ve in script
[ 0.015614] Not Found clk pll_periph0 in script
[ 0.015859] Not Found clk pll_de in script
[ 0.019832] bio: create slab <bio-0> at 0
[ 0.020250] pwm module init!
[ 0.022593] SCSI subsystem initialized
[ 0.022975] usbcore: registered new interface driver usbfs
[ 0.023177] usbcore: registered new interface driver hub
[ 0.023566] usbcore: registered new device driver usb
[ 0.023854] twi_chan_cfg()340 - [twi0] has no twi_regulator.
[ 0.024105] twi_chan_cfg()340 - [twi1] has no twi_regulator.
[ 0.024926] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x34)
[ 0.025195] axp20_board 0-0034: failed reading at 0x03
[ 0.025470] axp20_board: probe of 0-0034 failed with error -70
[ 0.025652] Linux video capture interface: v2.00
[ 0.025871] gpiochip_add: gpios 1024..1028 (axp_pin) failed to register
[ 0.026457] Advanced Linux Sound Architecture Driver Version 1.0.25.
[ 0.027368] Switching to clocksource arch_sys_counter
[ 0.029976] NET: Registered protocol family 2
[ 0.029976] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.030088] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.030383] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.030541] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.030789] TCP: reno registered
[ 0.030927] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.031186] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.031588] NET: Registered protocol family 1
[ 0.036956] standby_mode = 1.
[ 0.037102] wakeup src cnt is : 3.
[ 0.037258] pmu1_enable = 0x1.
[ 0.037392] pmux_id = 0x1.
[ 0.037646] config_pmux_para: script_parser_fetch err.
[ 0.037780] pmu2_enable = 0x0.
[ 0.037917] add_sys_pwr_dm: get ldo name failed
[ 0.038161] add_sys_pwr_dm: get ldo name failed
[ 0.038294] add_sys_pwr_dm: get ldo name failed
[ 0.038539] add_sys_pwr_dm: get ldo name failed
[ 0.038673] add_sys_pwr_dm: get ldo name failed
[ 0.038805] add_sys_pwr_dm: get ldo name failed
[ 0.039049] add_sys_pwr_dm: get ldo name failed
[ 0.039184] add_sys_pwr_dm: get ldo name failed
[ 0.039429] add_sys_pwr_dm: get ldo name failed
[ 0.039562] add_sys_pwr_dm: get ldo name failed
[ 0.039693] after inited: sys_mask config = 0x0.
[ 0.039939] dynamic_standby enalbe = 0x0.
[ 0.040192] sunxi_reg_init enter
[ 0.042311] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.042608] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.042930] msgmni has been set to 56
[ 0.043972] io scheduler noop registered
[ 0.044118] io scheduler deadline registered
[ 0.044443] io scheduler cfq registered (default)
[ 0.044977] [DISP]disp_module_init
[ 0.045512] cmdline,disp=
[ 0.046199] [DISP] disp_get_rotation_sw,line:68:disp 0 out of range? g_rot_sw=0
[ 0.046584] [DISP] disp_init_connections,line:289:NULL pointer: 0, 0
[ 0.049270] [DISP] Fb_map_kernel_logo,line:924:Fb_map_kernel_logo failed!
[ 0.052038] [DISP] disp_sys_power_enable,line:387:some error happen, fail to get regulator
[ 0.053202] [DISP]disp_module_init finish
[ 0.053608] sw_uart_get_devinfo()1503 - uart0 has no uart_regulator.
[ 0.054219] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
[ 0.054366] sw_uart_pm()890 - uart0 clk is already enable
[ 0.054621] sw_console_setup()1233 - console setup baud 115200 parity n bits 8, flow n
[ 0.168106] console [ttyS0] enabled
[ 0.693158] sunxi_spi_chan_cfg()1376 - [spi-0] has no spi_regulator.
[ 0.701167] spi spi0: master is unqueued, this is deprecated
[ 0.709217] Failed to alloc md5
[ 0.712928] eth0: Use random mac address
[ 0.717581] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.745091] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.754272] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1
[ 0.763044] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000
[ 0.780033] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00
[ 0.787525] hub 1-0:1.0: USB hub found
[ 0.791980] hub 1-0:1.0: 1 port detected
[ 0.796902] sunxi-ehci sunxi-ehci.1: remove, state 1
[ 0.802702] usb usb1: USB disconnect, device number 1
[ 0.809884] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[ 0.826456] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.853566] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver
[ 0.862347] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 1
[ 0.871029] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400
[ 0.934634] hub 1-0:1.0: USB hub found
[ 0.939056] hub 1-0:1.0: 1 port detected
[ 0.944018] sunxi-ohci sunxi-ohci.1: remove, state 1
[ 0.949665] usb usb1: USB disconnect, device number 1
[ 0.956101] sunxi-ohci sunxi-ohci.1: USB bus 1 deregistered
[ 0.972558] Initializing USB Mass Storage driver...
[ 0.978295] usbcore: registered new interface driver usb-storage
[ 0.985101] USB Mass Storage support registered.
[ 0.990762] file system registered
[ 0.996141] android_usb gadget: Mass Storage Function, version: 2009/09/11
[ 1.004080] android_usb gadget: Number of LUNs=1
[ 1.009328] lun0: LUN: removable file: (no medium)
[ 1.015344] android_usb gadget: android_usb ready
[ 1.020960] sunxikbd_script_init: key para not found, used default para.
[ 1.029586] sunxi-rtc sunxi-rtc: rtc core: registered sunxi-rtc as rtc0
[ 1.038112] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[ 1.047301] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[ 1.056172] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[ 1.064958] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[ 1.073743] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[ 1.082404] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[ 1.091162] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[ 1.100213] sunxi_wdt_init_module: sunxi WatchDog Timer Driver v1.0
[ 1.107475] sunxi_wdt_probe: devm_ioremap return wdt_reg 0xf1c20ca0, res->start 0x01c20ca0, res->end 0x01c20cbf
[ 1.118960] sunxi_wdt_probe: initialized (g_timeout=16s, g_nowayout=0)
[ 1.126787] wdt_enable, write reg 0xf1c20cb8 val 0x00000000
[ 1.133119] wdt_set_tmout, write 0x000000b0 to mode reg 0xf1c20cb8, actual timeout 16 sec
[ 1.143178] no led_3, ignore it!
[ 1.146916] no led_4, ignore it!
[ 1.150766] no led_5, ignore it!
[ 1.154468] no led_6, ignore it!
[ 1.158166] no led_7, ignore it!
[ 1.162781] usbcore: registered new interface driver usbhid
[ 1.169212] usbhid: USB HID core driver
[ 1.174278] ashmem: initialized
[ 1.178164] logger: created 256K log 'log_main'
[ 1.183516] logger: created 32K log 'log_events'
[ 1.188871] logger: created 32K log 'log_radio'
[ 1.194278] logger: created 32K log 'log_system'
[ 1.200956] script_get_item return type err, consider it no ldo
[ 1.208588] asoc: sndcodec <-> sunxi-codec mapping ok
[ 1.216351] TCP: cubic registered
[ 1.220218] NET: Registered protocol family 17
[ 1.225531] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 1.234380] ThumbEE CPU extension supported.
[ 1.239401] Registering SWP/SWPB emulation handler
[ 1.245869] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[ 1.255042] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[ 1.263759] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[ 1.272334] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[ 1.281020] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[ 1.289686] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[ 1.298452] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[ 1.307371] sunxi-rtc sunxi-rtc: setting system clock to 1970-01-01 04:37:28 UTC (16648)
[ 1.317941] ALSA device list:
[ 1.321435] #0: audiocodec
[ 1.324816] Warning: unable to open an initial console.
[ 1.330947] Waiting for root device /dev/ram0...
离线
不明白为什么设备树必须写到这个位置? write 0x41d00000 script.bin
离线
问题解决!随后更新Ramdisk启动方式,制作详细步骤
离线
U-Boot SPL 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39)
DRAM: 64 MiB
Trying to boot from FEL
U-Boot 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39 -0400) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 6
In: serial@01c28000
Out: serial@01c28000
Err: serial@01c28000
U-Boot 2017.01-rc2-00057-g32ab180 (Apr 06 2021 - 04:01:39 -0400) Allwinner Technology
CPU: Allwinner V3s (SUN8I 1681)
Model: Lichee Pi Zero
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment
Setting up a 800x480 lcd console (overscan 0x0)
dotclock: 33000kHz = 33000kHz: (1 * 3MHz * 66) / 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
(FEL boot)
## Executing script at 41e00000
## Booting kernel from Legacy Image at 41000000 ...
Image Name: Linux-3.4.39
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2457016 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 (osboxes@osboxes) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #29 Fri Apr 16 02:27:37 EDT 2021
[ 0.000000] Initialized persistent memory from 41d20800-41d307ff
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait initrd=0x41b00000,0x200000 root=/dev/ram init=/linuxrc 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: 28316k/28316k available, 37220k 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 - 0xc047f000 (4572 kB)
[ 0.000000] .init : 0xc047f000 - 0xc04a3000 ( 144 kB)
[ 0.000000] .data : 0xc04a4000 - 0xc04e8830 ( 275 kB)
[ 0.000000] .bss : 0xc04e8854 - 0xc0583494 ( 620 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.000168] Calibrating delay loop (skipped), value calculated using timer frequency.. 4800.00 BogoMIPS (lpj=24000000)
[ 0.000188] pid_max: default: 32768 minimum: 301
[ 0.000327] Mount-cache hash table entries: 512
[ 0.000888] CPU: Testing write buffer coherency: ok
[ 0.001153] Setting up static identity map for 0x40359488 - 0x403594e0
[ 0.001812] devtmpfs: initialized
[ 0.003527] pinctrl core: initialized pinctrl subsystem
[ 0.004013] NET: Registered protocol family 16
[ 0.004356] DMA: preallocated 128 KiB pool for atomic coherent allocations
[ 0.004418] script_sysfs_init success
[ 0.005167] gpiochip_add: registered GPIOs 0 to 223 on device: sunxi-pinctrl
[ 0.006065] sunxi-pinctrl sunxi-pinctrl: initialized sunXi PIO driver
[ 0.006440] gpiochip_add: registered GPIOs 1024 to 1031 on device: axp-pinctrl
[ 0.007264] persistent_ram: error in header, 4
[ 0.007277] persistent_ram: no valid data in buffer (sig = 0x00000000)
[ 0.014391] console [ram-1] enabled
[ 0.015207] Not Found clk pll_isp in script
[ 0.015463] Not Found clk pll_video in script
[ 0.015597] Not Found clk pll_ve in script
[ 0.015730] Not Found clk pll_periph0 in script
[ 0.015975] Not Found clk pll_de in script
[ 0.019920] bio: create slab <bio-0> at 0
[ 0.020285] pwm module init!
[ 0.022663] SCSI subsystem initialized
[ 0.023026] usbcore: registered new interface driver usbfs
[ 0.023334] usbcore: registered new interface driver hub
[ 0.023612] usbcore: registered new device driver usb
[ 0.023873] twi_chan_cfg()340 - [twi0] has no twi_regulator.
[ 0.024125] twi_chan_cfg()340 - [twi1] has no twi_regulator.
[ 0.024956] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x34)
[ 0.025226] axp20_board 0-0034: failed reading at 0x03
[ 0.025504] axp20_board: probe of 0-0034 failed with error -70
[ 0.025685] Linux video capture interface: v2.00
[ 0.026020] gpiochip_add: gpios 1024..1028 (axp_pin) failed to register
[ 0.026487] Advanced Linux Sound Architecture Driver Version 1.0.25.
[ 0.027421] Switching to clocksource arch_sys_counter
[ 0.029973] NET: Registered protocol family 2
[ 0.029973] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.030120] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.030411] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.030565] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.030810] TCP: reno registered
[ 0.030949] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.031205] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.031604] NET: Registered protocol family 1
[ 0.032052] Trying to unpack rootfs image as initramfs...
[ 0.033221] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.042563] Freeing initrd memory: 2048K
[ 0.042879] standby_mode = 1.
[ 0.043013] wakeup src cnt is : 3.
[ 0.043280] pmu1_enable = 0x1.
[ 0.043413] pmux_id = 0x1.
[ 0.043556] config_pmux_para: script_parser_fetch err.
[ 0.043801] pmu2_enable = 0x0.
[ 0.043938] add_sys_pwr_dm: get ldo name failed
[ 0.044072] add_sys_pwr_dm: get ldo name failed
[ 0.044320] add_sys_pwr_dm: get ldo name failed
[ 0.044453] add_sys_pwr_dm: get ldo name failed
[ 0.044585] add_sys_pwr_dm: get ldo name failed
[ 0.044829] add_sys_pwr_dm: get ldo name failed
[ 0.044961] add_sys_pwr_dm: get ldo name failed
[ 0.045205] add_sys_pwr_dm: get ldo name failed
[ 0.045337] add_sys_pwr_dm: get ldo name failed
[ 0.045469] add_sys_pwr_dm: get ldo name failed
[ 0.045712] after inited: sys_mask config = 0x0.
[ 0.045847] dynamic_standby enalbe = 0x0.
[ 0.046155] sunxi_reg_init enter
[ 0.048393] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.048583] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
[ 0.049019] msgmni has been set to 59
[ 0.050146] io scheduler noop registered
[ 0.050406] io scheduler deadline registered
[ 0.050623] io scheduler cfq registered (default)
[ 0.051271] [DISP]disp_module_init
[ 0.051804] cmdline,disp=
[ 0.052472] [DISP] disp_get_rotation_sw,line:68:disp 0 out of range? g_rot_sw=0
[ 0.052853] [DISP] disp_init_connections,line:289:NULL pointer: 0, 0
[ 0.055430] [DISP] Fb_map_kernel_logo,line:924:Fb_map_kernel_logo failed!
[ 0.058206] [DISP] disp_sys_power_enable,line:387:some error happen, fail to get regulator
[ 0.059369] [DISP]disp_module_init finish
[ 0.059777] sw_uart_get_devinfo()1503 - uart0 has no uart_regulator.
[ 0.060454] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
[ 0.060602] sw_uart_pm()890 - uart0 clk is already enable
[ 0.060861] sw_console_setup()1233 - console setup baud 115200 parity n bits 8, flow n
[ 0.174413] console [ttyS0] enabled
[ 0.724937] brd: module loaded
[ 0.729069] sunxi_spi_chan_cfg()1376 - [spi-0] has no spi_regulator.
[ 0.737127] spi spi0: master is unqueued, this is deprecated
[ 0.745256] Failed to alloc md5
[ 0.748923] eth0: Use random mac address
[ 0.753535] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.781248] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.790316] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1
[ 0.799067] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000
[ 0.820035] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00
[ 0.827419] hub 1-0:1.0: USB hub found
[ 0.831767] hub 1-0:1.0: 1 port detected
[ 0.836836] sunxi-ehci sunxi-ehci.1: remove, state 1
[ 0.842522] usb usb1: USB disconnect, device number 1
[ 0.848976] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[ 0.865434] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.892637] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver
[ 0.901321] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 1
[ 0.910003] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400
[ 0.974640] hub 1-0:1.0: USB hub found
[ 0.978944] hub 1-0:1.0: 1 port detected
[ 0.983825] sunxi-ohci sunxi-ohci.1: remove, state 1
[ 0.989610] usb usb1: USB disconnect, device number 1
[ 0.995909] sunxi-ohci sunxi-ohci.1: USB bus 1 deregistered
[ 1.012486] Initializing USB Mass Storage driver...
[ 1.018108] usbcore: registered new interface driver usb-storage
[ 1.025043] USB Mass Storage support registered.
[ 1.030611] file system registered
[ 1.035996] android_usb gadget: Mass Storage Function, version: 2009/09/11
[ 1.043963] android_usb gadget: Number of LUNs=1
[ 1.049333] lun0: LUN: removable file: (no medium)
[ 1.055498] android_usb gadget: android_usb ready
[ 1.061002] sunxikbd_script_init: key para not found, used default para.
[ 1.069744] sunxi-rtc sunxi-rtc: rtc core: registered sunxi-rtc as rtc0
[ 1.078199] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[ 1.087208] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[ 1.096194] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[ 1.104940] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[ 1.113720] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[ 1.122508] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[ 1.131158] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[ 1.140209] sunxi_wdt_init_module: sunxi WatchDog Timer Driver v1.0
[ 1.147583] sunxi_wdt_probe: devm_ioremap return wdt_reg 0xf1c20ca0, res->start 0x01c20ca0, res->end 0x01c20cbf
[ 1.159050] sunxi_wdt_probe: initialized (g_timeout=16s, g_nowayout=0)
[ 1.166767] wdt_enable, write reg 0xf1c20cb8 val 0x00000000
[ 1.173205] wdt_set_tmout, write 0x000000b0 to mode reg 0xf1c20cb8, actual timeout 16 sec
[ 1.183138] no led_3, ignore it!
[ 1.186959] no led_4, ignore it!
[ 1.190721] no led_5, ignore it!
[ 1.194427] no led_6, ignore it!
[ 1.198239] no led_7, ignore it!
[ 1.202696] usbcore: registered new interface driver usbhid
[ 1.209043] usbhid: USB HID core driver
[ 1.214200] ashmem: initialized
[ 1.217951] logger: created 256K log 'log_main'
[ 1.223297] logger: created 32K log 'log_events'
[ 1.228760] logger: created 32K log 'log_radio'
[ 1.234052] logger: created 32K log 'log_system'
[ 1.240949] script_get_item return type err, consider it no ldo
[ 1.248442] asoc: sndcodec <-> sunxi-codec mapping ok
[ 1.256344] TCP: cubic registered
[ 1.260322] NET: Registered protocol family 17
[ 1.265536] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 1.274441] ThumbEE CPU extension supported.
[ 1.279319] Registering SWP/SWPB emulation handler
[ 1.285818] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[ 1.294903] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[ 1.303601] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[ 1.312297] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[ 1.320867] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[ 1.329542] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[ 1.338413] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[ 1.347250] sunxi-rtc sunxi-rtc: setting system clock to 1970-01-01 00:34:49 UTC (2089)
[ 1.357772] ALSA device list:
[ 1.361277] #0: audiocodec
[ 1.365158] RAMDISK: gzip image found at block 0
[ 1.504469] VFS: Mounted root (ext2 filesystem) on device 1:0.
[ 1.511454] devtmpfs: mounted
[ 1.515177] Freeing init memory: 144K
Starting logging: OK
Initializing random number generator... done.
Starting network: OK
Welcome to Buildroot
buildroot login:
Welcome to Buildroot
buildroot login: root
#
#
#
# ls
#
#
# cd /
#
#
# ls
THIS_IS_NOT_YOUR_ROOT_FILESYSTEM mnt
bin opt
dev proc
etc root
init run
init_bk sbin
lib sys
lib32 tmp
linuxrc usr
lost+found var
media
#
#
离线
由于BSP驱动比较全,使用比较方便,所以优先使用,看到晕哥制作的FEL启动系统很方便,所为也要为BSP做了FEL方式启动整个系统,但遇到了问题,纵观整个论坛都是主线的方式,解决问题反复摸索的时间比较长。。。
离线
1.1 修改内核配置选项
make ARCH=arm menuconfig
打开配置菜单,修改配置项
Ramdisk方式需要清空Initramfs source file(s)
之所以(4096)是因为我之后制作的ramdisk是4096KB大小的。
如果这个大小和你做的ramdisk不匹配,则启动时仍然会出现 kernel panic,提示ramdisk格式不正确,挂载不上ramdisk。
注意:ramdisk是一种内存虚拟磁盘技术,实质上并不是一种文件系统,它使用的文件系统是ext2文件系统。
1.2 文件系统配置
其中Toolchain path是kernel的交叉编译链的位置
kernel的版本,在交叉编译链下面查看:
libc/usr/include/linux/version.h
我这里的 LINUX_VERSION_CODE 版本是 262144
将262144转换16进制40000
我的编译链版本是4.0.0
保存配置开始编译
编译完成后生成根文件系统
2. 修改内核启动参数
2.1 安装mkimage
sudo apt install mkimage
采用修改u-boot的bootargs环境变量来传递启动参数
修改bsp.cmd文件:一键制作boot.src.7z
2.2 安装sunxi-tools工具,制作script参数配置
git clone -b v3s https://github.com/Icenowy/sunxi-tools.git
make && sudo make install
一键制作script参数配置bin文件
一键制作script.bin.7z
3. 制作ramdisk镜像
安装工具: sudo apt install genext2fs
编译buildroot
cd 到 buildroot/output 执行
$ genext2fs -b 4096 -d target/ ramdisk
$ gzip -9 -f ramdisk
制作出镜像
builtroot/output/ramdisk.gz
到此制作出全部启动文件: boot.scr script.bin u-boot-sunxi-with-spl.bin ramdisk.gz uImage
离线
如果遇到这样的错误:
[ 1.437777] ALSA device list:
[ 1.441278] #0: audiocodec
[ 1.445157] RAMDISK: gzip image found at block 0
[ 1.584502] VFS: Mounted root (ext2 filesystem) on device 1:0.
[ 1.591484] devtmpfs: mounted
[ 1.595207] Freeing init memory: 144K
mount: you must be root
mount: you must be root
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: you must be root
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.
Starting network: ip: RTNETLINK answers: Operation not permitted
ip: SIOCSIFFLAGS: Permission denied
FAIL
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
查看busybox权限:
# buildroot-2017.08.1/output$ ll target/bin/busybox
-rwsr-xr-x 1 osboxes osboxes 675052 四月 12 04:35 target/bin/busybox*
解决办法:
chmod a-s busybox
离线
离线
离线
u-boot.cfg
lichee-v3s-ramdisk-linux.config
lichee-v3s-buildroot-ramdisk.config
Ramdisk配置.7z
离线