2014年9月26日 星期五

Running linaro ubuntu on i.MX6 sabre lite and nitrogen6x board: Such a Great post!!


http://boundarydevices.com/running-linaro-ubuntu-on-i-mx6-sabre-lite-and-nitrogen6x/


ARM toolchain 中叫做EABI 的東西, ABI

原文 http://blog.csdn.net/flagyan/article/details/6166107

EABI (Embedded Application Binary Interface)

ABI, 描述了應用程式與OS, 應用程式與函式庫, 應用程式的component之間的底層interface.
ABI允許編譯好的物件在使用兼容 ABI的系統中可以不需任何改動就能執行.

EABI的具體定義
http://support.codesourcery.com/GNUToolchain/kbentry32

Question
What is the ABI for the ARM Architecture? Is it the same as the ARM EABI?
Answer
The ABI for the ARM Architecture is a standard developed by ARM and its partners that explains how compilers, assemblers, linkers, and other similar tools should generate object files and executable files.
Tools that correctly implement the ABI for the ARM Architecture can interoperate; i.e., object files built with one toolchain can be combined with object files built with another toolchain if both compilers use the ABI for the ARM Architecture and provided that the code compiled observes certain conventions.
CodeSourcery was an active participant in the design of the ABI for the ARM Architecture. (In fact, the C++ ABI used by ARM is derived from the Itanium C++ ABI co-designed by CodeSourcery.) CodeSourcery continues to work with ARM, Ltd. to validate interoperability between Sourcery G++ and ARM's proprietary tools.
The "ARM EABI" is an informal name for the ABI for the ARM Architecture.


本來在看怎麼讓i.MX6裝上Freescale沒支援的ubuntu 12.04版本
http://feilipu.me/2013/11/09/udoo-ubuntu-12-04-guide/
http://boundarydevices.com/running-linaro-ubuntu-on-i-mx6-sabre-lite-and-nitrogen6x/
https://community.freescale.com/thread/313871
有人提了一句  何不用 armhf?   Could you please tell me, why didn't you made armhf linux?
繼續看armel armhf, 

http://baike.baidu.com/view/3547622.htm
什么是EABI?
Embedded application binary interface, 即嵌入式应用二进制接口,是描述可连接目标代码,库目标代码,可执行文件影像,如何连接,执行和调试,以及目标代码生成过程,和c, c++语言接口的规范,是编译连接工具的基础规范,也是研究它们工作原理的基础.
ddddd

http://fred-zone.blogspot.tw/2009/07/armarmel.html

在 Debian 5.0 Lenny Release 後,出現了一個新的名詞『armel』,可以在許多 ARM toolchain packages 身上看到,而 armel 顧名思義就是針對 ARM Architecture 的實作,但與古老的『arm』最大不同在於『armel』的移植是新的 ARM EABI ,對一些新的 ARM processor 特性有著更好的實作改進和支援,像是更動 Floating point、Stack alignment 等部份。
更多新的 ARM EABI 細節和說明,可以在 Debian 的官方 Wiki 上找到解答:
https://wiki.debian.org/ArmEabiPort

http://www.cnx-software.com/2012/05/18/getting-ubuntu-armelarmhf-rootfs-in-ubuntu-12-04/

2014年9月12日 星期五

人生中需要常常的sync, 否則你不知道自己脫離理想多遠

在安裝freescale 的ltib的東西時, 他用了一個長長的copy list去搬挪freescale自己的pkg到ltib機制下

做完之後, 理應執行ltib真正的動作: 檢查本地端缺少哪些pkg, 少了就是網路上抓

我卡在 "有幾個檔案指向404空連" 後來自己手動搬進去才能動

我想說freescale作的真差  搞到我要自己捲起袖子copy paste


但後來  無法複製....  現在懷疑是我當初的copy list動作不完整  漏了那些檔案
我一開始沒有去驗證freescale的動作是否完整  卡了自己一個工作天

--

人生 需要常常的sync
你遇到的情況可能離你以為的很遠

LTIB 我想翻桌

./ltib -m config     # 初始化一切
./ltib -m listpkgs   # 列出目前可得的pkg
./ltib -m prep -p <package name>  # 抓下該pkg的src code
        # Package name: 
        # U-boot : u-boot
        # Kernel : kernel-[版號]

./ltib -m scbuild -p <package name>  # 你改過src code後想build看看
./ltib -m scdeploy -p <package name>  # 你想把某pkg裝進rootfs

./ltib -m clean  #清除並反安裝目標源碼包
./ltib -m distclean  #完全清除並移除相關所有東西


找不到檔案:
https://community.freescale.com/thread/302971

用ubuntu 10.04安裝LTIB時,
./ltib -m config之後會碰到以下錯誤

/bin/bash: texi2dvi: command not found
要再安裝 texinfo

2014年9月11日 星期四

OS bootstrapping 觀念

initrd
initrd 可以將 /lib/modules/.... 內的『開機過程當中一定需要的模組』包成一個檔案 (檔名就是 initrd), 然後在開機時透過主機的 INT 13 硬體功能將該檔案讀出來解壓縮,並且 initrd 在記憶體內會模擬成為根目錄, 由於此虛擬檔案系統 (Initial RAM Disk) 主要包含磁碟與檔案系統的模組,因此我們的核心最後就能夠認識實際的磁碟, 那就能夠進行實際根目錄的掛載啦!所以說:『initrd 內所包含的模組大多是與開機過程有關,而主要以檔案系統及硬碟模組 (如 usb, SCSI 等) 為主』的啦!

2014年9月5日 星期五

Freescale Yocto Project build for imx

ENV setup:
MACHINE=[BOARD_NAME] source ~.sh -b [BUILD_DIR]/ -e [x11/~]  以x11為例

ENV setup過後, [BUILD_DIR]就存在了, 以後想要建立build environment的話並不需要再度建立, 而是用這個指令讀取建立即可

Restarting a build environment:
source setup-environment [BUILD_DIR]

整份全build:   // 副作用未知, changes會被還原?! 待確認
bitbake fsl-image-x11

列出可得的package: 
bitbake -s

Linux kernel coding:
modified_then_build () {
        bitbake virtual/kernel -c compile -f
        bitbake virtual/kernel -c deploy
}

built_then_get_images () {
        //go to [BUILD_DIR]/tmp/deploy/images/[BOARD_NAME]/
        //find -> uImage-[BOARD_NAME].bin    ,save as uImage
        //       ->uImage-~~~~~~~~~~~.dtb      , save as [BOARD_NAME].dtb
        //       ->uImage-~~~~~~~~~~~-hdcp.dtb,save as [BOARD_NAME]-hdcp.dtb
        //       ->uImage-~~~~~~~~~~~-ldo.dtb , save as [BOARD_NAME]-ldo.dtb
}

U-boot coding:
modified_then_build () {
        bitbake -c compile u-boot-imx -f
        bitbake -c deploy u-boot-imx
}

built_then_get_images () {
        //go to [BUILD_DIR]/tmp/deploy/images/[BOARD_NAME]/
        //find -> u-boot.imx   , save as something
        // $ dd if=u-boot.imx of=[SDCARD] bs=512 seek=2
}

Board info tuning:

New kernel of L3.10 uses device tree, all those hardware related config will be passed from dtb to kernel, you can refer to arch/arm/boot/dts/imx6q.dtsi, arch/arm/boot/dts/imx6qdl.dtsi and arch/arm/boot/dts/imx6qdl-sabresd.dtsi's ecspi node. grep spi in these three files to see how device tree works.
replace "spi" to whatever you're looking for.
https://community.freescale.com/thread/317999

GPIO 設定:
http://www.kosagi.com/w/index.php?title=Definitive_GPIO_guide

IOMUX 參數設定:

    舊版freescale作法

所有定義寫在
~/arch/arm/plat-mxc/include/mach/iomux-mx6dl.h
~/arch/arm/plat-mxc/include/mach/iomux-v3.h
組合成像是  MX6DL_PAD_CSI0_DAT4__IPU1_CSI0_D_4 的巨集

另外使用一個標頭檔
~/arch/arm/mach-mx6/board-mx6dl_sabresd.h
把你要的寫進去
.init_machine 時,  讀取啟動

    新版freescale作法(Device Tree)

所有定義寫在
~/arch/arm/boot/dts/imx6dl-pinfunc.h
#define MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x074 0x388 0x000 0x0 0x0

在   imx6q.dtsi  imx6qdl.dtsi  imx6qdl-sabresd.dtsi  中
區段中宣告啟動
pinctrl_ipu1_csi0_d4_d7: ipu1-csi0-d4-d7 {
fsl,pins = < MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x80000000 MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x80000000 MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x80000000 MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x80000000 >;
};


關於pin setting, 論壇有回答

Every pin needs to have its PAD configured in the dts file. For example:

MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000

The explanation of what these values mean is available at:
Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt
and
Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt

The 0x80000000 means that the kernel will not touch the PAD settings and it will use whatever comes from default (or from U-boot in case it was previously configured in U-boot).

Regards,

Fabio Estevam
https://community.freescale.com/thread/317876

順便看這個  https://www.kernel.org/doc/Documentation/pinctrl.txt

pin control追"fsl,pins"字眼
查 drivers/pinctrl/pinctrl-imx.c 可以看到如何解析fsl,pins結構

Each pin represented in fsl,pins consists of 5 u32 PIN_FUNC_ID and 1 u32 CONFIG, so 24 types in total for each pin.


....

Yocto Project

http://www.yoctoproject.org/docs/1.6/kernel-dev/kernel-dev.html
http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html

偷筆記
https://github.com/graciahoney/IntelNote/tree/master/Yocto_Note

2014年9月4日 星期四

DDR Clock in iMX51

iMX51 好像boot rom code 就包含 setup clk。 所以在 boot code 中都沒有看到設定 (只有讀出來)。 有關 DDR clk 的設定,在 FreeScale Forume 有提到: User Manual Section: 7.3.3.6 CCM Bus Clock Divider Register. 其中
  • bit 30 : Select for DDR main clock
  • bit29-27 : Divider for DDR podf
這兩項 field 的說明有提到 變更這兩項後, ddr clk 的狀態會 update 到 CCM Divider Handshake In-Process Register 對應的 bit
  • bit 8 : ddr src select mux is budy
  • bit 7 : ddr_podf_busy
這幾個 busy bit 是 0 代表轉換完成。

[轉]iMX51 the very first boot process -- configure DDR controller and load bootloader to run

當設定為 SD/MMC boot。 boot ROM 會從第3 個 sector (第 0x400byte) 讀取 DCD (Device Configuration Data)。 放在 SD/MMC 中,由 boot ROM load 進 DRAM 中 run 的 code 是 u-boot。 所以 u-boot 的 bin 檔要包含這段 DCD 在 bin 的開頭。 imx51 的 uboot 是用 flash_header.S 來完成。 flash_header.o 在 lds 會被擺在 bin 的最前頭。 flash_header.S 的開頭: .org CONFIG_FLASH_HEADER_OFFSET另外定義 CONFIG_FLASH_HEADER_OFFSET 是 0x400。 另外,在 DCD table 最後是: .word _end - TEXT_BASE其中,_end 宣告在 u-boot.lds 中,是 bin 的最後。 TEXT_BASE 定義在 board 的 config.mk。是 u-boot load 到 ram 的位址。

所以在 iMX , DDR 的參數設定是由 boot-rom 的 code 做的,他會參考 boot device 的 DCD 內容設定register,然後再 load bootloader 到 DDR。 要 load 的長度和target address也是寫在 boot device 的 DCD 中。

DCD Table (Device Configuration Data Table) in i.MX

Some technical notes: The i.MX SoCs USB ROM boot mode supports doing register writesand file uploads. The files are usually uploaded to SDRAM. For this to work the SDRAM has to be initialized first. The information necessary to do this is contained in the imximage itself, more exactly in the DCD table. The imx-usb-loader parses this table and translates the DCD into register writes, basically it resembles what the i.MX would do in ROM code when the same image would be loaded from another bootsource like SD/MMC cards. Still the i.MX needs the DCD table to be uploaded. The i.MX would execute the DCD data again, which would result in corrupting the just configured SDRAM. The imx-usb-loader prevents this by setting the DCD length to 0x0 before uploading the image.
The i.MX Boot ROM supports different types of images to upload. The imx-usb-loader currently only handles the simple case of uploading a single image which is executed right after downloading.

Bitbake .... what a Fxxx

先看這篇
http://www.eettaiwan.com/ART_8800658883_676964_TA_def90a4a.HTM?jumpto=view_welcomead_1409798439009

Hello Bitbake World
http://hambedded.org/blog/2012/11/24/from-bitbake-hello-world-to-an-image/

How should you create your Bitbake recipe
http://stackoverflow.com/questions/20853404/bitbake-default-bb-base-bbclass-does-not-define-a-useful-default-task

in sources/meta-fsl-arm/classes/image_types_fsl.bbclass :

#
# Create an image that can by written onto a SD card using dd for use
# with i.MX SoC family
#
# External variables needed:
# ${SDCARD_ROOTFS} - the rootfs image to incorporate
# ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox}
#
# The disk layout used is:
#
# 0 -> IMAGE_ROOTFS_ALIGNMENT - reserved to bootloader (not partitioned)
# IMAGE_ROOTFS_ALIGNMENT -> BOOT_SPACE - kernel and other data
# BOOT_SPACE -> SDIMG_SIZE - rootfs
#
# Default Free space = 1.3x
# Use IMAGE_OVERHEAD_FACTOR to add more space
# <--------->
# 4MiB 8MiB SDIMG_ROOTFS 4MiB
# <-----------------------> <----------> <----------------------> <------------------------------>
# ------------------------ ------------ ------------------------ -------------------------------
# | IMAGE_ROOTFS_ALIGNMENT | BOOT_SPACE | ROOTFS_SIZE | IMAGE_ROOTFS_ALIGNMENT |
# ------------------------ ------------ ------------------------ -------------------------------
# ^ ^ ^ ^ ^
# | | | | |
# 0 4096 4MiB + 8MiB 4MiB + 8Mib + SDIMG_ROOTFS 4MiB + 8MiB + SDIMG_ROOTFS + 4MiB

generate_imx_sdcard() {
        ....
}

in sources/poky/meta/classes/image_types.bbclass :

runimagecmd () {
    //各家算法可能不同
    ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{size = $1 * ${IMAGE_OVERHEAD_FACTOR}; print (size > ${IMAGE_ROOTFS_SIZE} ? size : ${IMAGE_ROOTFS_SIZE}) }'`
}

in sources/poky/meta/conf/bitbake.conf
....
IMAGE_ROOTFS_SIZE ?= "65536"
....


配置文件主要分為兩類:設備配置與發行版(distro)配置。另外還有本地配置文件以及名為‘bitbake.conf’的文件。Bitbake.conf是BitBake讀取的第一個文件,包含所有其它配置文件。此外,它還可定義許多全局變量,並稱之為bitbake.conf。不建議直接修改bitbake.conf,建議在distro配置文件或本地配置文件中進行覆蓋。設備配置文件可定義特定目標電路板。發行版配置文件可為一台以上的設備定義特定的Linux發行版(如各種數據封包版本)。

2014年9月2日 星期二

linux驱动程序之-时钟管理

http://blog.csdn.net/bingqingsuimeng/article/category/1228965

[轉]LINUX中的MACH定义之MACHINE_START / MACHINE_END


http://blog.csdn.net/thl789/article/details/6699259

[轉]编写Android.mk中的LOCAL_SRC_FILES的终极技巧

http://blog.ready4go.com/blog/2013/05/20/write-local-src-files-in-android-dot-mk-ultimate-skills/

Android 好站紀錄

http://huenlil.pixnet.net/blog    //H's 手札  整理很多Android相關問題

把 gcc 切回 4.4 - update-alternative


先確認有裝 gcc 相關的檔案(g++, libs ... etc.)都是 4.4,可以查 /usr/bin/gcc-4.4 和 /usr/bin/g++-4.4 是否存在

sudo apt-get install gcc-4.4 g++-4.4 gcc-4.4-multilib g++-4.4-multilib


然後利用 update-alternative 把4.6 切成 4.4 即可:

$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/g++-4.4

$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/g++-4.6

$sudo update-alternatives --config gcc

選擇 4.4
Android內核是基於Linux 2.6內核的(目前最新開發版本是2.6.31),它是一個增強內核版本,除了修改部分Bug外,它提供了用於支持Android平台的設備驅動,其核心驅動主要包括:


Android Binder,基於OpenBinder框架的一個驅動,用於提供Android平台的process間通訊(IPC,inter-process communication)。
源代碼位於drivers/staging/android/binder.c

Android電源管理(PM),一個基於標準Linux電源管理系統的輕量級的Android電源管理驅動,針對嵌入式設備做了很多最佳化。
源代碼位於kernel/power/earlysuspend.c
kernel/power/consoleearlysuspend.c
kernel/power/fbearlysuspend.c
kernel/power/wakelock.c
kernel/power/userwakelock.c

低記憶體管理器(Low Memory Killer),相對於Linux標準OOM(Out Of Memory)機制更加靈活,它可以根據需要殺死process來釋放需要的記憶體。
源代碼位於drivers/staging/android/lowmemorykiller.c

寫英文履歷

http://www.sprinklesandsuits.com/2012/09/blog-post_15.html

http://www.teepr.com/29051/27%E5%80%8B%E4%BD%A0%E5%BF%85%E9%A0%88%E8%A6%81%E6%8A%84%E8%A5%B2%E7%9A%84%E5%B1%A5%E6%AD%B7%E8%A1%A8/

U-boot 環境變數

bootdelay    執行自動啟動的等候秒數
baudrate    串口控制台的波特率
netmask    乙太網接口的掩碼
ethaddr    乙太網卡的網卡物理地址
bootfile    缺省的下載文件
bootargs    傳遞給內核的啟動參數
bootcmd    自動啟動時執行的命令
serverip    服務器端的ip地址
ipaddr    本地ip 地址
stdin    標準輸入設備
stdout    標準輸出設備
stderr    標准出錯設備


上面只是一些最基本的環境變量,請注意,板子裡原本是沒有環境變量的,u-boot的缺省情況下會有一些基本的環境變量,在你執行了saveenv之後,環境變量會第一次保存到flash中,之後你對環境變量的修改,保存都是基於保存在flash中的環境變量的操作。

seeed studio //深圳

http://techorange.com/2014/08/22/seeed-vc-startup-manufacture/

人家在戰國時代互相廝殺精進武藝

美國主流影視業分鏡圖設計師 李威闖出一片天



低調盜圖....請多連回原出處 有更多好東西!