打印
[STM32F4]

使用Buildroot编译STM32F429 linux内核,文件系统成功

[复制链接]
3198|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
不爱说话|  楼主 | 2018-6-20 14:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Buildroot是一组Makefile和Patch文件,用来简化和自动化为嵌入式系统建造一个完整和可引导的Linux环境的过程,特别是在使用交叉编译来允许在单一的基于Linux的开发系统上为多个目标平台进行建造的时候。以上内容摘自wiki百科:)

最近我发现了Buildroot这个工具(其实早就知道,只是没了解过)出现了stm32的配置文件,于是拿来尝试。下载了最新的版本buildroot-2018.02.2.tar.gz
解压到一个目录:tar xzvf buildroot-2018.02.2.tar.gz
进入目录:cd buildroot-2018.02.2   
配置STM32F429:make ARCH=arm stm32f429_disco_defconfig
编译:make ARCH=arm

剩下的就是等待,Buildroot会自动编译目标系统需要的bootloader,linux kernel,file system。在此过程中它会自动下载需要的软件包,编译器。。。
由于我选择了使用buildroot自动编译,因此这货下载了gcc源码并编译gcc,这花了大约2个小时,后面真正编译的时间并不长也就20分钟不到,最后编译成功,在output/images目录会得到编译好的bootloader,kernel和文件系统。真是太方便了,这在以前是需要我做很多步骤才能完成的事。

下一步烧到板子里试试,看能不能工作。
沙发
xyz549040622| | 2018-6-20 14:30 | 只看该作者
赞一个,期待实际运行速度的测试。

使用特权

评论回复
板凳
caijie001| | 2018-6-21 00:44 | 只看该作者
期待教程啊哈哈哈

使用特权

评论回复
地板
不爱说话|  楼主 | 2018-6-25 21:16 | 只看该作者
在我的STM32F429板子上测试,Buildroot生成的文件系统可以使用。之前我构造的文件系统是按照网上搜索的步骤一步一步做出来的,现在简单多了。
鉴于我的板子和STM32F429 Discovery有些区别,需要修改一些源码,所以没有测试buildroot生成的u-boot和kernel,下面就是使用buildroot root filesystem启动linux的log:
## Booting kernel from Legacy Image at c0007fb4 ...
   Image Name:   linux-4.12_STM32F429
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2994400 Bytes =  2.9 MB
   Load Address: c0008000
   Entry Point:  c0008001
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at c0400000 ...
   Image Name:
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    459264 Bytes = 448.5 kB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at c0800000
   Booting using the fdt blob at 0xc0800000
   Loading Kernel Image ... OK
OK
   Loading Ramdisk to c3f8f000, end c3fff200 ... OK
   Loading Device Tree to c3f88000, end c3f8eece ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.0-rc4 (hw@localhost.localdomain) (gcc ver
sion 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715] (GNU
Tools for ARM Embedded Processors)) #3 PREEMPT Tue Oct 17 14:53:53 CST 2017
[    0.000000] CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] OF: fdt: Machine model: STMicroelectronics STM32F429i-DISCO
board
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: stm32_platform=stm-disco console=ttyS0,
115200 panic=10
[    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: 61364K/65536K available (1176K kernel code, 132K rwd
ata, 380K rodata, 1160K init, 114K bss, 4172K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]       .text : 0xc0008000 - 0xc012e378   (1177 kB)
[    0.000000]       .init : 0xc01a0000 - 0xc02c2000   (1160 kB)
[    0.000000]       .data : 0xc02c2000 - 0xc02e30e0   ( 133 kB)
[    0.000000]        .bss : 0xc02e30e0 - 0xc02ffab4   ( 115 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] /soc/interrupt-controller@40013c00: 23 External IRQs detecte
d
[    0.000000] clocksource: arm_system_timer: mask: 0xffffff max_cycles: 0x
ffffff, max_idle_ns: 355517175 ns
[    0.000000] ARM System timer initialized as clocksource
[    0.000000] /soc/timer@40000c00: STM32 clockevent driver initialized (32
bits)
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps
every 21474836475000000ns
[    0.010000] Calibrating delay loop... 13.33 BogoMIPS (lpj=66688)
[    0.140000] pid_max: default: 4096 minimum: 301
[    0.140000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.140000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 by
tes)
[    0.160000] Hierarchical SRCU implementation.
[    0.180000] devtmpfs: initialized
[    0.320000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xfffffff
f, max_idle_ns: 19112604462750000 ns
[    0.330000] pinctrl core: initialized pinctrl subsystem
[    0.450000] stm32f429-pinctrl soc:pin-controller: GPIOA bank added
[    0.460000] stm32f429-pinctrl soc:pin-controller: GPIOB bank added
[    0.460000] stm32f429-pinctrl soc:pin-controller: GPIOC bank added
[    0.470000] stm32f429-pinctrl soc:pin-controller: GPIOD bank added
[    0.470000] stm32f429-pinctrl soc:pin-controller: GPIOE bank added
[    0.480000] stm32f429-pinctrl soc:pin-controller: GPIOF bank added
[    0.480000] stm32f429-pinctrl soc:pin-controller: GPIOG bank added
[    0.490000] stm32f429-pinctrl soc:pin-controller: GPIOH bank added
[    0.490000] stm32f429-pinctrl soc:pin-controller: GPIOI bank added
[    0.500000] stm32f429-pinctrl soc:pin-controller: GPIOJ bank added
[    0.500000] stm32f429-pinctrl soc:pin-controller: GPIOK bank added
[    0.500000] stm32f429-pinctrl soc:pin-controller: Pinctrl STM32 initiali
zed
[    0.610000] stm32-dma 40026000.dma-controller: STM32 DMA driver register
ed
[    0.630000] stm32-dma 40026400.dma-controller: STM32 DMA driver register
ed
[    0.640000] random: fast init done
[    0.650000] clocksource: Switched to clocksource arm_system_timer
[    5.610000] Trying to unpack rootfs image as initramfs...
[    6.040000] Freeing initrd memory: 452K
[    6.060000] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    6.270000] io scheduler noop registered (default)
[    6.270000] io scheduler mq-deadline registered
[    6.270000] io scheduler kyber registered
[    6.280000] STM32 USART driver initialized
[    6.290000] 40011000.serial: ttyS0 at MMIO 0x40011000 (irq = 32, base_ba
ud = 5250000) is a stm32-usart
[    6.640000] console [ttyS0] enabled
[    6.860000] brd: module loaded
[    6.970000] stm32_rtc 40002800.rtc: Can't enter in init mode. Prescaler
config failed.
[    6.980000] stm32_rtc: probe of 40002800.rtc failed with error -110
[    6.980000] i2c /dev entries driver
[    6.990000] IR NEC protocol handler initialized
[    7.000000] IR RC5(x/sz) protocol handler initialized
[    7.000000] IR RC6 protocol handler initialized
[    7.010000] IR JVC protocol handler initialized
[    7.010000] IR Sony protocol handler initialized
[    7.020000] IR SANYO protocol handler initialized
[    7.020000] IR Sharp protocol handler initialized
[    7.030000] IR MCE Keyboard/mouse protocol handler initialized
[    7.030000] IR XMP protocol handler initialized
[    7.080000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    7.090000] hctosys: unable to open rtc device (rtc0)
[    7.220000] Freeing unused kernel memory: 1160K
[    7.230000] This architecture does not have kernel memory protection.
Initializing random number generator... done.

Welcome to Buildroot
buildroot login: root
Jan  1 00:00:17 login[47]: root login on 'console'
~ # ls
~ # pwd
/root
~ # cd ..
/ # ls
bin      init     linuxrc  opt      run      tmp
dev      lib      media    proc     sbin     usr
etc      lib32    mnt      root     sys      var
/ # ls dev
console             mem                 ram3
cpu_dma_latency     memory_bandwidth    ram4
full                network_latency     ram5
gpiochip0           network_throughput  ram6
gpiochip1           null                ram7
gpiochip10          pts                 ram8
gpiochip2           ram0                ram9
gpiochip3           ram1                random
gpiochip4           ram10               shm
gpiochip5           ram11               tty
gpiochip6           ram12               ttyS0
gpiochip7           ram13               urandom
gpiochip8           ram14               zero
gpiochip9           ram15
kmsg                ram2
/ #


使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

115

主题

886

帖子

34

粉丝