经过前面的移植,新版BSP的uboot和kernel已经能够在tqimx6q开发板上运行了,接下来我们来挂载文件系统。
DTB整理
前面的文章中提到,新版BSP的DTB管理感觉不是太好,在之前移植的BSP上我发现即便有根文件系统,内核也会挂掉,由于原来的DTS文件中配置内容太多,不好确定问题的源头,本文对DTS进行了整理,整理后只需要一个DTS文件,其内容如下:
- /*
- * Copyright 2012 Freescale Semiconductor, Inc.
- * Copyright 2011 Linaro Ltd.
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
- /dts-v1/;
- #include "imx6q.dtsi"
- / {
- <span style="white-space:pre"> </span>model = "Freescale i.MX6 Quad SABRE Smart Device Board";
- <span style="white-space:pre"> </span>compatible = "fsl,imx6q-sabresd", "fsl,imx6q";
- <span style="white-space:pre"> </span>memory {
- <span style="white-space:pre"> </span>reg = <0x10000000 0x80000000>;
- <span style="white-space:pre"> </span>};
- };
- &uart1 {
- <span style="white-space:pre"> </span>pinctrl-names = "default";
- <span style="white-space:pre"> </span>pinctrl-0 = <&pinctrl_uart1_2>;
- <span style="white-space:pre"> </span>status = "okay";
- };
- &usdhc2 {
- <span style="white-space:pre"> </span>pinctrl-names = "default";
- <span style="white-space:pre"> </span>pinctrl-0 = <&pinctrl_usdhc2_2>;
- <span style="white-space:pre"> </span>cd-gpios = <&gpio1 4 0>;
- <span style="white-space:pre"> </span>wp-gpios = <&gpio1 2 0>;
- <span style="white-space:pre"> </span>no-1-8-v;
- <span style="white-space:pre"> </span>keep-power-in-suspend;
- <span style="white-space:pre"> </span>enable-sdio-wakeup;
- <span style="white-space:pre"> </span>status = "okay";
- };
- &iomuxc {
- <span style="white-space:pre"> </span>pinctrl-names = "default";
- <span style="white-space:pre"> </span>uart1 {
- <span style="white-space:pre"> </span>pinctrl_uart1_2: uart1grp-2 {
- <span style="white-space:pre"> </span>fsl,pins = <
- <span style="white-space:pre"> </span>MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1
- <span style="white-space:pre"> </span>MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA 0x1b0b1
- <span style="white-space:pre"> </span>>;
- <span style="white-space:pre"> </span>};
- <span style="white-space:pre"> </span>};
- };
- git checkout imx6qdl.dtsi
根文件系统的制作方法本文就不再赘述了,可以参考本博客S5PV210相关的记载。本人将制作好的根文件系统打包上传到网盘,如果您也懒得重新制作根文件系统可以暂时使用鄙人制作的的这个:
下面开始制作启动SD卡:
Step1. 使用fdisk命令对SD卡进行分区
其实,移植3.0内核版本的BSP时已经使用过fdisk命令,与之前的不同是分区的起始offset改在20M的位置上,具体如下:
(1) 启动分区指令
其中sdb请根据自己的实际情况制定,执行之前一定要再三确认好,以免误操作导致文件丢失。
- sudo fdisk /dev/sdb
按u然后回车,重复操作直至切换到sector模式。
(3) 删除既有分区
按d然后回车,重复操作直至删除所有分区。
(4) 创建新分区
按n创建新分区。
(5) 执行分区类型。
按p选择为主分区。
(6) 输入起始偏移
输入"+20M",指定该分区的起始位置是20M的位置上。
(7) 输入结束偏移
本文仅使用了一个分区,故直接按回车,表示该分区的结束位置是磁盘的末尾。
(8) 保存分区信息
按w然后回车,即可保存分区信息。
Step2. 格式化分区
使用mkfs命令格式化新创建的分区,对于移动设备,可以考虑使用ext3或者ext4文件系统,指令如下:
- sudo mkfs.ext3 /dev/sdb1
- sudo mkfs.ext4 /dev/sdb1
Step3. 拷贝根文件系统
由于本人之前制作好的根文件系统是个压缩包,故直接解压到该分区即可。
- sudo mount /dev/sdb1 /mnt
- sudo tar jxf rootfs.tar.bz2 -C /mnt
- sudo mv /mnt/rootfs/* /mnt
- sudo rm /mnt/rootfs
- sudo umount /mnt
配置uboot环境变量
- setenv bootargs 'noinitrd console=ttymxc0,115200 root=/dev/mmcblk0p1 rw init=/linuxrc'
- setenv bootcmd 'mmc dev 0; mmc read 0x11ffffc0 0x800 0x3000; mmc read 0x18000000 0x5000 0x800; bootm 0x11ffffc0 - 0x18000000'
- saveenv
效果展示
启动Log如下:
- U-Boot 2013.04-04987-g98fdbdc-dirty (May 03 2015 - 11:46:24)
- CPU: Freescale i.MX6Q rev1.2 at 792 MHz
- CPU: Temperature 27 C, calibration data: 0x54e4bb69
- Reset cause: POR
- Board: MX6Q/SDL-SabreSD
- I2C: ready
- DRAM: 1 GiB
- MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
- No panel detected: default to Hannstar-XGA
- Display: Hannstar-XGA (1024x768)
- In: serial
- Out: serial
- Err: serial
- mmc0 is current device
- Net: Phy not found
- PHY reset timed out
- FEC [PRIME]
- Warning: failed to set MAC address
- Normal Boot
- Hit any key to stop autoboot: 0
- mmc0 is current device
- MMC read: dev # 0, block # 2048, count 12288 ... 12288 blocks read: OK
- MMC read: dev # 0, block # 20480, count 2048 ... 2048 blocks read: OK
- ## Booting kernel from Legacy Image at 11ffffc0 ...
- Image Name: Linux-3.10.17-80739-g33597e3-dir
- Image Type: ARM Linux Kernel Image (uncompressed)
- Data Size: 5289224 Bytes = 5 MiB
- Load Address: 12000000
- Entry Point: 12000000
- Verifying Checksum ... OK
- ## Flattened Device Tree blob at 18000000
- Booting using the fdt blob at 0x18000000
- XIP Kernel Image ... OK
- OK
- Using Device Tree in place at 18000000, end 1800befb
- Starting kernel ...
- Booting Linux on physical CPU 0x0
- Linux version 3.10.17-80739-g33597e3-dirty (lilianrong@lenovo) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #1 SMP PREEMPT Sun May 3 11:31:37 CST 2015
- CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
- CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
- Machine: Freescale i.MX6 Quad/DualLite (Device Tree), model: Freescale i.MX6 Quad SABRE Smart Device Board
- cma: CMA: reserved 320 MiB at 3c000000
- Memory policy: ECC disabled, Data cache writealloc
- PERCPU: Embedded 8 pages/cpu @814f8000 s8896 r8192 d15680 u32768
- Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260096
- Kernel command line: noinitrd console=ttymxc0,115200 root=/dev/mmcblk0p1 rw rootfstype=ext4 init=/linuxrc
- PID hash table entries: 4096 (order: 2, 16384 bytes)
- Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
- Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
- Memory: 1024MB = 1024MB total
- Memory: 697800k/697800k available, 350776k reserved, 0K highmem
- Virtual kernel memory layout:
- vector : 0xffff0000 - 0xffff1000 ( 4 kB)
- fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
- vmalloc : 0xc0800000 - 0xff000000 (1000 MB)
- lowmem : 0x80000000 - 0xc0000000 (1024 MB)
- pkmap : 0x7fe00000 - 0x80000000 ( 2 MB)
- modules : 0x7f000000 - 0x7fe00000 ( 14 MB)
- .text : 0x80008000 - 0x80be704c (12157 kB)
- .init : 0x80be8000 - 0x80c2a2c0 ( 265 kB)
- .data : 0x80c2c000 - 0x80c7c260 ( 321 kB)
- .bss : 0x80c7c260 - 0x80ce5434 ( 421 kB)
- SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
- Preemptible hierarchical RCU implementation.
- NR_IRQS:16 nr_irqs:16 16
- L310 cache controller enabled
- l2x0: 16 ways, CACHE_ID 0x410000c7, AUX_CTRL 0x32070000, Cache size: 1048576 B
- sched_clock: 32 bits at 3000kHz, resolution 333ns, wraps every 1431655ms
- CPU identified as i.MX6Q, silicon rev 1.2
- Console: colour dummy device 80x30
- Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)
- pid_max: default: 32768 minimum: 301
- Mount-cache hash table entries: 512
- CPU: Testing write buffer coherency: ok
- CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
- Setting up static identity map for 0x80610608 - 0x80610660
- CPU1: Booted secondary processor
- CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
- CPU2: Booted secondary processor
- CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
- CPU3: Booted secondary processor
- CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
- Brought up 4 CPUs
- SMP: Total of 4 processors activated (6324.22 BogoMIPS).
- CPU: All CPU(s) started in SVC mode.
- devtmpfs: initialized
- pinctrl core: initialized pinctrl subsystem
- regulator-dummy: no parameters
- NET: Registered protocol family 16
- DMA: preallocated 256 KiB pool for atomic coherent allocations
- Use WDOG1 as reset source
- syscon 20c8000.anatop: regmap [mem 0x020c8000-0x020c8fff] registered
- vdd1p1: 800 <--> 1375 mV at 1125 mV
- vdd3p0: 2800 <--> 3150 mV at 3000 mV
- vdd2p5: 2000 <--> 2750 mV at 2425 mV
- cpu: 725 <--> 1450 mV at 1150 mV
- vddpu: 725 <--> 1450 mV
- vddsoc: 725 <--> 1450 mV at 1200 mV
- syscon 20e0000.iomuxc-gpr: regmap [mem 0x020e0000-0x020e0037] registered
- syscon 21bc000.ocotp-ctrl: regmap [mem 0x021bc000-0x021bffff] registered
- hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
- hw-breakpoint: maximum watchpoint size is 4 bytes.
- imx6q-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver
- bio: create slab <bio-0> at 0
- mxs-dma 110000.dma-apbh: initialized
- i2c-core: driver [max17135] using legacy suspend method
- i2c-core: driver [max17135] using legacy resume method
- SCSI subsystem initialized
- usbcore: registered new interface driver usbfs
- usbcore: registered new interface driver hub
- usbcore: registered new device driver usb
- Linux video capture interface: v2.00
- pps_core: LinuxPPS API ver. 1 registered
- pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
- PTP clock support registered
- imx-ipuv3 2400000.ipu: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
- imx-ipuv3 2800000.ipu: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
- MIPI CSI2 driver module loaded
- Advanced Linux Sound Architecture Driver Initialized.
- cfg80211: Calling CRDA to update world regulatory domain
- Switching to clocksource mxc_timer1
- NET: Registered protocol family 2
- TCP established hash table entries: 8192 (order: 4, 65536 bytes)
- TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
- TCP: Hash tables configured (established 8192 bind 8192)
- TCP: reno registered
- UDP hash table entries: 512 (order: 2, 16384 bytes)
- UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
- NET: Registered protocol family 1
- RPC: Registered named UNIX socket transport module.
- RPC: Registered udp transport module.
- RPC: Registered tcp transport module.
- RPC: Registered tcp NFSv4.1 backchannel transport module.
- hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
- pureg-dummy: no parameters
- imx6_busfreq busfreq.15: DDR medium rate not supported.
- Bus freq driver module loaded
- VFS: Disk quotas dquot_6.5.2
- Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
- NFS: Registering the id_resolver key type
- Key type id_resolver registered
- Key type id_legacy registered
- jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
- fuse init (API version 7.22)
- msgmni has been set to 2002
- io scheduler noop registered
- io scheduler deadline registered
- io scheduler cfq registered (default)
- imx-weim 21b8000.weim: WEIM driver registered.
- MIPI DSI driver module loaded
- imx-sdma 20ec000.sdma: no iram assigned, using external mem
- imx-sdma 20ec000.sdma: loaded firmware 1.1
- imx-sdma 20ec000.sdma: initialized
- Serial: IMX driver
- 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX
- console [ttymxc0] enabled
- serial: Freescale lpuart driver
- [drm] Initialized drm 1.1.0 20060810
- [drm] Initialized vivante 1.0.0 20120216 on minor 0
- brd: module loaded
- loop: module loaded
- CAN device driver interface
- ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
- usbcore: registered new interface driver usb-storage
- mousedev: PS/2 mouse device common for all mice
- i2c-core: driver [isl29023] using legacy suspend method
- i2c-core: driver [isl29023] using legacy resume method
- snvs_rtc 20cc034.snvs-rtc-lp: rtc core: registered 20cc034.snvs-rtc-lp as rtc0
- i2c /dev entries driver
- i2c-core: driver [mag3110] using legacy suspend method
- i2c-core: driver [mag3110] using legacy resume method
- imx2-wdt 20bc000.wdog: IMX2+ Watchdog Timer enabled. timeout=60s (nowayout=0)
- cpuidle: using governor ladder
- cpuidle: using governor menu
- sdhci: Secure Digital Host Controller Interface driver
- sdhci: Copyright(c) Pierre Ossman
- sdhci-pltfm: SDHCI platform and OF driver helper
- mmc0: no vqmmc regulator found
- mmc0: no vmmc regulator found
- mmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
- mmc0: host does not support reading read-only switch. assuming write-enable.
- mmc0: new high speed SDHC card at address e624
- mmcblk0: mmc0:e624 SS08G 7.40 GiB
- mmcblk0: p1
- Galcore version 4.6.9.9754
- mxc_vdoa 21e4000.vdoa: i.MX Video Data Order Adapter(VDOA) driver probed
- mxc_asrc 2034000.asrc: mxc_asrc registered
- mxc_vpu 2040000.vpu: VPU initialized
- caam 2100000.caam: device ID = 0x0a16010000000000 (Era -524)
- caam 2100000.caam: job rings = 2, qi = 0
- caam 2100000.caam: authenc-hmac-md5-cbc-aes-caam
- caam 2100000.caam: authencesn-hmac-md5-cbc-aes-caam
- caam 2100000.caam: authenc-hmac-sha1-cbc-aes-caam
- caam 2100000.caam: authencesn-hmac-sha1-cbc-aes-caam
- caam 2100000.caam: authenc-hmac-sha224-cbc-aes-caam
- caam 2100000.caam: authencesn-hmac-sha224-cbc-aes-caam
- caam 2100000.caam: authenc-hmac-sha256-cbc-aes-caam
- caam 2100000.caam: authencesn-hmac-sha256-cbc-aes-caam
- caam 2100000.caam: authenc-hmac-md5-cbc-des3_ede-caam
- caam 2100000.caam: authencesn-hmac-md5-cbc-des3_ede-caam
- caam 2100000.caam: authenc-hmac-sha1-cbc-des3_ede-caam
- caam 2100000.caam: authencesn-hmac-sha1-cbc-des3_ede-caam
- caam 2100000.caam: authenc-hmac-sha224-cbc-des3_ede-caam
- caam 2100000.caam: authencesn-hmac-sha224-cbc-des3_ede-caam
- caam 2100000.caam: authenc-hmac-sha256-cbc-des3_ede-caam
- caam 2100000.caam: authencesn-hmac-sha256-cbc-des3_ede-caam
- caam 2100000.caam: authenc-hmac-md5-cbc-des-caam
- caam 2100000.caam: authencesn-hmac-md5-cbc-des-caam
- caam 2100000.caam: authenc-hmac-sha1-cbc-des-caam
- caam 2100000.caam: authencesn-hmac-sha1-cbc-des-caam
- caam 2100000.caam: authenc-hmac-sha224-cbc-des-caam
- caam 2100000.caam: authencesn-hmac-sha224-cbc-des-caam
- caam 2100000.caam: authenc-hmac-sha256-cbc-des-caam
- caam 2100000.caam: authencesn-hmac-sha256-cbc-des-caam
- caam 2100000.caam: ecb-des-caam
- caam 2100000.caam: ecb-arc4-caam
- caam 2100000.caam: ecb-aes-caam
- caam 2100000.caam: ctr-aes-caam
- caam 2100000.caam: cbc-aes-caam
- caam 2100000.caam: ecb-des3-caam
- caam 2100000.caam: cbc-3des-caam
- caam 2100000.caam: cbc-des-caam
- caam 2100000.caam: fsl,sec-v4.0 algorithms registered in /proc/crypto
- platform 2101000.jr0: registering rng-caam
- platform caam_sm: caam_sm_test: 8-byte key test match OK
- platform caam_sm: caam_sm_test: 16-byte key test match OK
- platform caam_sm: caam_sm_test: 32-byte key test match OK
- platform caam_secvio.16: security violation service handlers armed
- usbcore: registered new interface driver usbhid
- usbhid: USB HID core driver
- i2c-core: driver [cs42888] using legacy suspend method
- i2c-core: driver [cs42888] using legacy resume method
- TCP: cubic registered
- NET: Registered protocol family 10
- sit: IPv6 over IPv4 tunneling driver
- NET: Registered protocol family 17
- can: controller area network core (rev 20120528 abi 9)
- NET: Registered protocol family 29
- can: raw protocol (rev 20120528)
- can: broadcast manager protocol (rev 20120528 t)
- can: netlink gateway (rev 20130117) max_hops=1
- 8021q: 802.1Q VLAN Support v1.8
- Key type dns_resolver registered
- VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
- snvs_rtc 20cc034.snvs-rtc-lp: setting system clock to 1970-01-01 00:01:12 UTC (72)
- ALSA device list:
- No soundcards found.
- EXT4-fs (mmcblk0p1): recovery complete
- EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
- VFS: Mounted root (ext4 filesystem) on device 179:1.
- devtmpfs: mounted
- Freeing unused kernel memory: 264K (80be8000 - 80c2a000)
- ----------mount all..........
- ----------Starting mdev......
- Please press Enter to activate this console.
- @tqimx6q #
本次移植不是很顺利,让DTS折腾了一下午,最终决定使用现在这种方式移植,不过这种方式可以更深入的学习DTS。文中有不妥之处请帮忙指出,有任何疑问可以留言讨论。