Linux on the i.MX6 sabre sd platform in a few commands

本文介绍如何在 i.MX6 Sabre SD 平台上使用几个简单命令快速启动 Linux。首先确保 U-Boot 已正确安装并运行,接着获取 Linux 源代码并使用 ARM 交叉编译器进行编译。之后将编译后的内核及设备树二进制文件复制到 SD 卡的 FAT 分区,并确保 U-Boot 能从该分区加载这些文件。最后插入 SD 卡并启动平台。

Linux on the i.MX6 sabre sd platform in a few commands

Here is a quick summary at booting Linux on the i.MX 6 sabre sd platform.

 

This assumes you already have u-boot working on your platform as described here. This implies you already have a "working" Linux development environment with some ARM cross-compilers at hand (e.g. Debian + Emdebian).

 

Get Linux sources

 

We will use git to fetch Linux sources:


  $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


This should create a linux directory with all the latest sources (after a while).


Note that for more stability you might want to checkout a release instead of the latest version; to do so, list the available release tags with e.g. git tag -l 'v3.*', and git checkout <the-desired-tag>.

 

Compile

 

Assuming your cross compiler is called e.g. arm-linux-gnueabihf-gcc, you can compile by doing:

 

  $ cd linux

  $ export ARCH=arm

  $ export CROSS_COMPILE=arm-linux-gnueabihf-

  $ make imx_v6_v7_defconfig

  $ make

  $ make uImage


This should create a number of files, including arch/arm/boot/uImage and arch/arm/boot/dts/imx6q-sabresd.dtb.

 

Put on SD

We need a proper FAT partition on the SD card, from which u-boot will be able to load the kernel and dtb. Also, we need to make sure we leave some space for u-boot starting from offset 1024B. Here is an example SD card layout:

 

  +-----+------+--------+-----+----------------

  | MBR |  ... | u-boot | ... | FAT partition ...

  +-----+------+--------+-----+----------------

  0     512    1024           1M

 

(offsets in bytes)

 

Here is an example SD card layout, as displayed by fdisk:

 

  Device    Boot      Start         End      Blocks   Id  System

  /dev/sdc1            2048     8054783     4026368    c  W95 FAT32 (LBA)

 

(units: 512B sectors)

 

You can format the FAT partition, mount, copy and unmount with:


  $ mkfs.vfat /dev/<your-sd-card-first-partition>

  $ mount /dev/<your-sd-card-first-partition> /mnt

  $ cp arch/arm/boot/uImage arch/arm/boot/dts/imx6q-sabresd.dtb /mnt/

  $ umount /mnt


Your SD card first partition is typically something in /dev/sd<X>1 or /dev/mmcblk<X>p1. Note that you need write permissions on the SD card for the command to succeed, so you might need to su - as root, or use sudo, or do a chmod a+w as root on the SD card device node to grant permissions to users.


Also, be sure to have u-boot on the SD card as explained in this post.

 

Boot!

 

That's it; u-boot already knows how to deal with your kernel by default so you are good to go. Insert the SD card into the SD card slot of your i.MX6 sabre sd platform, connect to the USB to UART port with a serial terminal set to 115200 baud, no parity, 8bit data and power up the platform. You should see u-boot messages:

 

  U-Boot 2013.07-rc1-00014-g74771f4 (Jun 21 2013 - 16:27:39)


u-boot should load the uImage and dtb from SD card and boot the kernel:


  (...)

  reading uImage

  4215344 bytes read in 449 ms (9 MiB/s)

  Booting from mmc ...

  reading imx6q-sabresd.dtb

  22818 bytes read in 22 ms (1012.7 KiB/s)

  ## Booting kernel from Legacy Image at 12000000 ...

     Image Name:   Linux-3.10.0-rc6

     Image Type:   ARM Linux Kernel Image (uncompressed)

     Data Size:    4215280 Bytes = 4 MiB

     Load Address: 10008000

     Entry Point:  10008000

     Verifying Checksum ... OK

  ## Flattened Device Tree blob at 11000000

     Booting using the fdt blob at 0x11000000

     Loading Kernel Image ... OK

  OK

     Using Device Tree in place at 11000000, end 11008921

 

 

  Starting kernel ...

 

The kernel should boot:

 

  Booting Linux on physical CPU 0x0

  Linux version 3.10.0-rc6 (vstehle@debian) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Fri Jun 21 18:09:26 CEST 2013


By default, the kernel will try to mount a root filesystem from the SD card second partition, as can be read in the default kernel command line:


  (...)

  Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw

 

...but we did not prepare a root filesystem partition, so after a number of boot messages the kernel will wait indefinitely:

 

  (...)

  mmc1: new SDHC card at address b368

  (...)

   mmcblk0: p1

  (...)

  Waiting for root device /dev/mmcblk1p2...

 

We will see in another post how to prepare this root filesystem on the second SD card partition. Enjoy!

 

See also...

 

  • If you plan to compile Linux often, you might want to use a C compiler cache; see this post.
  • Once you have Linux booting on your platform the next step is to give it a root filesystem. See this post for a Debian root filesystem, this post for a minimal busybox filesystem and this post for generating a root filesystem with buildroot.

考虑柔性负荷的综合能源系统低碳经济优化调度【考虑碳交易机制】(Matlab代码实现)内容概要:本文围绕“考虑柔性负荷的综合能源系统低碳经济优化调度”展开,重点研究在碳交易机制下如何实现综合能源系统的低碳化与经济性协同优化。通过构建包含风电、光伏、储能、柔性负荷等多种能源形式的系统模型,结合碳交易成本与能源调度成本,提出优化调度策略,以降低碳排放并提升系统运行经济性。文中采用Matlab进行仿真代码实现,验证了所提模型在平衡能源供需、平抑可再生能源波动、引导柔性负荷参与调度等方面的有效性,为低碳能源系统的设计与运行提供了技术支撑。; 适合人群:具备一定电力系统、能源系统背景,熟悉Matlab编程,从事能源优化、低碳调度、综合能源系统等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①研究碳交易机制对综合能源系统调度决策的影响;②实现柔性负荷在削峰填谷、促进可再生能源消纳中的作用;③掌握基于Matlab的能源系统建模与优化求解方法;④为实际综合能源项目提供低碳经济调度方案参考。; 阅读建议:建议读者结合Matlab代码深入理解模型构建与求解过程,重点关注目标函数设计、约束条件设置及碳交易成本的量化方式,可进一步扩展至多能互补、需求响应等场景进行二次开发与仿真验证。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值