全志v3s学习笔记(7)——Buildroot 根文件系统构建

一、获取Buildroot

wget https://buildroot.org/downloads/buildroot-2019.08.tar.gz
tar xvf buildroot-2019.08.tar.gz&&cd buildroot-2019.08/
make menuconfig

二、基本配置:

Target options  --->
	Target Architecture (ARM (little endian))  --->
	Target Binary Format (ELF)  --->
	Target Architecture Variant (cortex-A7)  --->
	Target ABI (EABIhf)  --->
	Floating point strategy (VFPv4-D16)  --->
	ARM instruction set (ARM)  ---> 

三、编译工具链配置:

Toolchain  --->
	Toolchain type (External toolchain)  --->
	*** Toolchain External Options ***
	Toolchain (Custom toolchain)  --->
	Toolchain origin (Pre-installed toolchain)  --->
	(/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/) Toolchain path
	($(ARCH)-linux-gnueabihf) Toolchain prefix
	External toolchain gcc version (4.9.x)  --->
	External toolchain kernel headers series (4.0.x)  --->
	External toolchain C library (glibc/eglibc)  --->
	[*] Toolchain has SSP support? (NEW)
	[*] Toolchain has RPC support? (NEW)
	[*] Toolchain has C++ support? 
	[*] Enable MMU support (NEW) 

查询编译工具链所在位置:

which arm-linux-gnueabihf-gcc

读取编译工具链里的内核版本:
编译工具链内核头文件是/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/linux里面的version.h,可以从中读取内核版本。

cat /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/linux/version.h
#define LINUX_VERSION_CODE 262144
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

262144的二进制为0x400000,则对应的内核版本号为4.0.0。


四、其他配置:

还可以设置主机名,root密码,配置自己需要的软件包等,后续再更新。

五、编译:

make

如果出错则使用make clean然后再编译。
编译完成后,生成的根文件系统在 output/images/rootfs.tar


六、烧录

# 查询挂载名
df -h
# 把buildroot产生的rootfs.tar解压到第二分区根目录
sudo tar xvf output/images/rootfs.tar -C /挂载的tf卡第二个分区目录(例:/media/pjw/9009f48f-8b2b-4b4c-a7f8-21887dd8432b)

在这里插入图片描述


七、LOG

如果 ext4 挂载出错请参考:
【问题解决】报错:EXT4-fs (mmcblk0p2): couldn‘t mount RDWR because of unsupported optional features (400)

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 134 ms (17.3 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) ) #13 Tue Mar 16 14:49:47 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.000175] pid_max: default: 32768 minimum: 301
[    0.000317] Mount-cache hash table entries: 512
[    0.000863] CPU: Testing write buffer coherency: ok
[    0.001126] Setting up static identity map for 0x40351820 - 0x40351878
[    0.001786] devtmpfs: initialized
[    0.003426] pinctrl core: initialized pinctrl subsystem
[    0.003909] NET: Registered protocol family 16
[    0.004214] DMA: preallocated 128 KiB pool for atomic coherent allocations
[    0.004277] script_sysfs_init success
[    0.005031] gpiochip_add: registered GPIOs 0 to 223 on device: sunxi-pinctrl
[    0.005812] sunxi-pinctrl sunxi-pinctrl: initialized sunXi PIO driver
[    0.006182] gpiochip_add: registered GPIOs 1024 to 1031 on device: axp-pinctrl
[    0.006992] persistent_ram: uncorrectable error in header
[    0.007010] persistent_ram: no valid data in buffer (sig = 0x55175515)
[    0.014246] console [ram-1] enabled
[    0.015058] Not Found clk pll_isp in script 
[    0.015201] Not Found clk pll_video in script 
[    0.015445] Not Found clk pll_ve in script 
[    0.015578] Not Found clk pll_periph0 in script 
[    0.015820] Not Found clk pll_de in script 
[    0.019728] bio: create slab <bio-0> at 0
[    0.020147] pwm module init!
[    0.022456] SCSI subsystem initialized
[    0.022841] usbcore: registered new interface driver usbfs
[    0.023043] usbcore: registered new interface driver hub
[    0.023425] usbcore: registered new device driver usb
[    0.023689] twi_chan_cfg()340 - [twi0] has no twi_regulator.
[    0.023939] twi_chan_cfg()340 - [twi1] has no twi_regulator.
[    0.024755] sunxi_i2c_do_xfer()985 - [i2c0] incomplete xfer (status: 0x20, dev addr: 0x34)
[    0.025018] axp20_board 0-0034: failed reading at 0x03
[    0.025181] axp20_board: probe of 0-0034 failed with error -70
[    0.025473] Linux video capture interface: v2.00
[    0.025695] gpiochip_add: gpios 1024..1028 (axp_pin) failed to register
[    0.026271] Advanced Linux Sound Architecture Driver Version 1.0.25.
[    0.027180] Switching to clocksource arch_sys_counter
[    0.029942] NET: Registered protocol family 2
[    0.029942] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.029958] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.030302] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.030460] TCP: Hash tables configured (established 2048 bind 2048)
[    0.030707] TCP: reno registered
[    0.030847] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.031106] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.031515] NET: Registered protocol family 1
[    0.031977] standby_mode = 1. 
[    0.032227] wakeup src cnt is : 3. 
[    0.032381] pmu1_enable = 0x1. 
[    0.032513] pmux_id = 0x1. 
[    0.032768] config_pmux_para: script_parser_fetch err. 
[    0.032901] pmu2_enable = 0x0. 
[    0.033037] add_sys_pwr_dm: get ldo name failed
[    0.033282] add_sys_pwr_dm: get ldo name failed
[    0.033414] add_sys_pwr_dm: get ldo name failed
[    0.033547] add_sys_pwr_dm: get ldo name failed
[    0.033791] add_sys_pwr_dm: get ldo name failed
[    0.033924] add_sys_pwr_dm: get ldo name failed
[    0.034170] add_sys_pwr_dm: get ldo name failed
[    0.034301] add_sys_pwr_dm: get ldo name failed
[    0.034434] add_sys_pwr_dm: get ldo name failed
[    0.034679] add_sys_pwr_dm: get ldo name failed
[    0.034813] after inited: sys_mask config = 0x0. 
[    0.035059] dynamic_standby enalbe = 0x0. 
[    0.035237] sunxi_reg_init enter
[    0.037303] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.037610] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
[    0.037940] msgmni has been set to 59
[    0.039127] io scheduler noop registered
[    0.039272] io scheduler deadline registered
[    0.039597] io scheduler cfq registered (default)
[    0.040195] [DISP]disp_module_init
[    0.040718] cmdline,disp=
[    0.041059] [DISP] disp_get_rotation_sw,line:68:disp 0 out of range? g_rot_sw=0
[    0.041438] [DISP] disp_init_connections,line:289:NULL pointer: 0, 0
[    0.041885] [DISP] display_fb_request,line:1142:invalid paras xres(0), yres(0) bpp(16) 
[    0.043963] [DISP]disp_module_init finish
[    0.044475] sw_uart_get_devinfo()1503 - uart0 has no uart_regulator.
[    0.044962] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
[    0.045222] sw_uart_pm()890 - uart0 clk is already enable
[    0.045373] sw_console_setup()1233 - console setup baud 115200 parity n bits 8, flow n
[    0.158852] console [ttyS0] enabled
[    0.675763] sunxi_spi_chan_cfg()1376 - [spi-0] has no spi_regulator.
[    0.683659] spi spi0: master is unqueued, this is deprecated
[    0.691721] Failed to alloc md5
[    0.695384] eth0: Use random mac address
[    0.699919] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.727545] sunxi-ehci sunxi-ehci.1: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.736703] sunxi-ehci sunxi-ehci.1: new USB bus registered, assigned bus number 1
[    0.745355] sunxi-ehci sunxi-ehci.1: irq 104, io mem 0xf1c1a000
[    0.770040] sunxi-ehci sunxi-ehci.1: USB 0.0 started, EHCI 1.00
[    0.777408] hub 1-0:1.0: USB hub found
[    0.781871] hub 1-0:1.0: 1 port detected
[    0.786745] sunxi-ehci sunxi-ehci.1: remove, state 1
[    0.792540] usb usb1: USB disconnect, device number 1
[    0.799241] sunxi-ehci sunxi-ehci.1: USB bus 1 deregistered
[    0.815682] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.842758] sunxi-ohci sunxi-ohci.1: SW USB2.0 'Open' Host Controller (OHCI) Driver
[    0.851528] sunxi-ohci sunxi-ohci.1: new USB bus registered, assigned bus number 1
[    0.860098] sunxi-ohci sunxi-ohci.1: irq 105, io mem 0xf1c1a400
[    0.924609] hub 1-0:1.0: USB hub found
[    0.928920] hub 1-0:1.0: 1 port detected
[    0.933902] sunxi-ohci sunxi-ohci.1: remove, state 1
[    0.939554] usb usb1: USB disconnect, device number 1
[    0.945852] sunxi-ohci sunxi-ohci.1: USB bus 1 deregistered
[    0.962399] Initializing USB Mass Storage driver...
[    0.968012] usbcore: registered new interface driver usb-storage
[    0.974930] USB Mass Storage support registered.
[    0.980482] file system registered
[    0.985936] android_usb gadget: Mass Storage Function, version: 2009/09/11
[    0.993752] android_usb gadget: Number of LUNs=1
[    0.999113]  lun0: LUN: removable file: (no medium)
[    1.005113] android_usb gadget: android_usb ready
[    1.010611] sunxikbd_script_init: key para not found, used default para. 
[    1.019329] sunxi-rtc sunxi-rtc: rtc core: registered sunxi-rtc as rtc0
[    1.027845] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.036735] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.045873] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.054668] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.063333] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.072086] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.080838] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.089753] sunxi_wdt_init_module: sunxi WatchDog Timer Driver v1.0
[    1.097128] sunxi_wdt_probe: devm_ioremap return wdt_reg 0xf1c20ca0, res->start 0x01c20ca0, res->end 0x01c20cbf
[    1.108592] sunxi_wdt_probe: initialized (g_timeout=16s, g_nowayout=0)
[    1.116308] wdt_enable, write reg 0xf1c20cb8 val 0x00000000
[    1.122740] wdt_set_tmout, write 0x000000b0 to mode reg 0xf1c20cb8, actual timeout 16 sec
[    1.134670] no led_3, ignore it!
[    1.138413] no led_4, ignore it!
[    1.142151] no led_5, ignore it!
[    1.145964] no led_6, ignore it!
[    1.149665] no led_7, ignore it!
[    1.155349] usbcore: registered new interface driver usbhid
[    1.161823] usbhid: USB HID core driver
[    1.166889] ashmem: initialized
[    1.170902] logger: created 256K log 'log_main'
[    1.176297] logger: created 32K log 'log_events'
[    1.181689] logger: created 32K log 'log_radio'
[    1.186936] logger: created 32K log 'log_system'
[    1.193886] script_get_item return type err, consider it no ldo
[    1.205023] asoc: sndcodec <-> sunxi-codec mapping ok
[    1.210933] *******************Try sdio*******************
[    1.219206] TCP: cubic registered
[    1.223236] NET: Registered protocol family 17
[    1.228447] VFP support v0.3: [mmc]: *** sunxi_mci_dump_errinfo(L826): smc 0 err, cmd 5,  RTO !!
[    1.238747] ThumbEE CPU extension supported.
[    1.243637] *******************Try sd *******************
[    1.249876] Registering SWP/SWPB emulation handler
[    1.256276] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.265461] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.275387] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.286254] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.294970] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.303561] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.312456] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.321378] sunxi-rtc sunxi-rtc: setting system clock to 1970-01-01 00:00:05 UTC (5)
[    1.331608] ALSA device list:
[    1.335183]   #0: audiocodec
[    1.339091] Waiting for root device /dev/mmcblk0p2...
[    1.346106] mmc0: new high speed SDHC card at address b368
[    1.352906] mmcblk0: mmc0:b368 NCard 29.1 GiB 
[    1.359515]  mmcblk0: p1 p2
[    1.363646] mmcblk mmc0:b368: Card claimed for testing.
[    1.369591] mmc0:b368: NCard 29.1 GiB 
[    1.374032] platform reg-20-cs-dcdc2: Driver reg-20-cs-dcdc2 requests probe deferral
[    1.382915] *******************sd init ok*******************
[    1.389386] platform reg-20-cs-dcdc3: Driver reg-20-cs-dcdc3 requests probe deferral
[    1.398161] platform reg-20-cs-ldo1: Driver reg-20-cs-ldo1 requests probe deferral
[    1.406846] platform reg-20-cs-ldo2: Driver reg-20-cs-ldo2 requests probe deferral
[    1.415525] platform reg-20-cs-ldo3: Driver reg-20-cs-ldo3 requests probe deferral
[    1.424089] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe deferral
[    1.432764] platform reg-20-cs-ldoio0: Driver reg-20-cs-ldoio0 requests probe deferral
[    1.451170] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[    1.461330] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
[    1.518216] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.527543] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.549515] devtmpfs: mounted
[    1.553380] Freeing init memory: 140K
[    1.751195] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator... done.
Starting network: OK

Welcome to Buildroot
buildroot login: 

参考:【Linux系统移植】Buildroot 根文件系统构建荔枝派-buildroot根文件系统

相关推荐
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:白松林 返回首页