porting android for FreeSkyle imx6 sabre-6q sd-card & nfs

porting-android-for-FreeSkyle-imx6-sabre-6q-sd-card
厂家手册把多种开发板,多种配置混在一起说,写了28页
看着累啊,这里单就imx6 sabre-6q sd-card 来说明porting 过程。
其中有些次序及混乱的地方进行了合理调整
算一个工作笔记。

小插曲:  原2.3 先放到前面吧,跟编译无关,测试用
----------------------------------------
2.3 Running Android with a prebuilt image
----------------------------------------
sabre-6q core image-sd
sabre-6q full image-sd


TFTP and NFS 可以尝试。

****************************************
2 编译准备:Preparation
****************************************
----------------------------------------
2.1 Setting up your computer
----------------------------------------
$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools


----------------------------------------

2.2 Unpacking Android release package

KK4.4.3_2.0.0-ga 版本补丁包

----------------------------------------
# cd /opt
$ tar xzvf android_KK4.4.3_2.0.0-ga_core_source.tar.gz
$ cd android_KK4.4.3_2.0.0-ga_core_source/code/
$ tar xzvf KK4.4.3_2.0.0-ga.tar.gz


****************************************
3 Building Android for i.MX
****************************************
----------------------------------------
3.1 Getting Android source code (Android/kernel/U-Boot)
----------------------------------------
$ cd ~
$ mkdir myandroid
$ mkdir bin
$ cd myandroid
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ ~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.3_r1
$ ~/bin/repo sync # this command loads most needed repos. Therefore, it can take several hours to load.
#### .repo 有35G, 累得吐血。 1M 下载速度也要半天一夜.


If you use U-Boot as your bootloader, then you can clone the U-Boot git repository from Freescale open source git:
$ cd myandroid/bootable
$ cd bootloader
$ git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout kk4.4.3_2.0.0-ga

Get KK4.4.3_2.0.0-ga kernel source code from Freescale open source git:
$ cd myandroid
$ git clone git://git.freescale.com/imx/linux-2.6-imx.git kernel_imx # the kernel repo is heavy. Therefore, this process can take a while.
### 这个kernel 也要下一会。
$ cd kernel_imx
$ git checkout kk4.4.3_2.0.0-ga

----------------------------------------
3.2 Patch code for i.MX
----------------------------------------
1. Assume you have unzipped the i.MX Android release package to /opt/android_KK4.4.3_2.0.0-ga_source .
$ cd ~/myandroid
$ source /opt/android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga/and_patch.sh
$ help
2. You should see that the "c_patch" function is available.
$ c_patch /opt/android_KK4.4.3_2.0.0-ga_core_source/code/KK4.4.3_2.0.0-ga imx_KK4.4.3_2.0.0-ga
Here, "/opt/android_KK4.4.3_2.0.0-ga_source/code/KK4.4.3_2.0.0-ga" is the location of the patches,
which is the directory created when you unzip the release package.
"imx_KK4.4.3_2.0.0-ga" is the branch which will be created automatically for you to hold all patches
(only in those existing Google gits).
You can choose any branch name instead of "imx_KK4.4.3_2.0.0-ga".
3. If everything is OK, "c_patch" will generate the following output to indicate the successful patch:

Success: Now you can build the Android code for FSL i.MX platform
----------------------------------------
3.3  Patch Freescale extended features code
player and wifi (optional)
----------------------------------------

----------------------------------------
3.4  Building Android images
----------------------------------------
$ cd ~/myandroid
$ source build/envsetup.sh
$ lunch sabresd_6dq-user
$ make 2>&1 | tee build_sabresd_6dq_android.log
"sabresd_6dq" is the product name (see ~/myandroid/device/fsl/product)
After build, check build_*_android.log to make sure no build error.

Install system fs image: out/target/product/sabresd_6dq/system.img
编译出system.img 包括.repo 总大小为71G, 又用了一个晚上,4核cpu 100%跑啊。

实验 system.img 可以替换预编译的system.img

........................................
3.4.1 User build mode
........................................
make PRODUCT-sabresd_6dq-user # 该img 不支持调试功能
 在device/fsl/imx6/imx6.mk 中可以自定义包PRODUCT_PACKAGES 项下.


#Build Android images for i.MX 6 SABRE-SD boards
----------------------------------------
3.5 Building U-Boot images
----------------------------------------
After you set up U-Boot using the steps outlined above, you can find the tool (mkimage) under tools/.
$ cd ~/myandroid/bootable/bootloader/uboot-imx
$ export ARCH=arm
$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
$ make distclean
For i.MX 6Quad SABRE-SD:
$ make mx6qsabresdandroid_config
$ make

"u-boot.imx" is generated if you have a successful build.



----------------------------------------
3.6 Building a kernel image
----------------------------------------
To run Android using NFS, or from SD, build the kernel with the default configuration as described below:
Assume you had already built U-Boot. mkimage was generated under
myandroid/bootable/bootloader/uboot-imx/tools/ and it
is in your PATH.
$ export PATH=~/myandroid/bootable/bootloader/uboot-imx/tools:$PATH
$ cd ~/myandroid/kernel_imx
$ echo $ARCH && echo $CROSS_COMPILE
Make sure you have those two environment variables set. If the two variables are not set, set them as:
$ export ARCH=arm
$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-

# To build the kernel image for i.MX6Dual/Quad, 6DualLite, and 6Solo
$ make imx_v7_android_defconfig
$ make uImage LOADADDR=0x10008000
when succeed, android/kernel_imx/arch/arm/boot/uImage. will be created

---------------------------------------
3.7 Building boot.img
----------------------------------------
$ make bootimage  ### 默认是eMMC 启动, 用sd 启动,请看下面

............................................................
3.4.2 Building Android image for the SD card on the SABRE-SD Board
      别怪我,手册介绍顺序乱,我这里更正下,放到这了
............................................................
The default configuration in the source code package takes internal eMMC as the boot storage.
It can be changed to make the
SD card in SD Slot 3 as the boot storage as follows:
cd ..
### remove out/target/product/sabresd_6dq/root directory and boot*.img
rm -rf out/target/product/sabresd_6dq/root
rm  out/target/product/sabresd_6dq/boot*.img
### remove out/target/product/sabresd_6dq/recovery directory and recovery*.img
rm -rf out/target/product/sabresd_6dq/recovery
rm out/target/product/sabresd_6dq/recovery*.img

make bootimage BUILD_TARGET_DEVIC=sd | tee make_bootimage.log


****************************************
4 Downloading Images
****************************************
----------------------------------------
4.1.1 System on SD
----------------------------------------
a. U-Boot image: u-boot.imx
b. boot image: boot.img
c. Android system root image: system.img
d. Recovery root image: recovery.img
4.1.1 Storage partitions
前1M 为bootloader.
主分区1 为 boot            8M 开始,大小8M        kernel+ramdisk
主分区2 为 Recovery        大小8M                kernel+ramdisk
主分区3 为扩展分区,包括
        logic 5            SYSTEM,  512M  ext4        /
        logic 6            CACHE,  512M    ext4
        logic 7            Device,  8M        ext4
        logic 8            Misc,  4M
主分区4 为 Data        follow Misc, 大小为剩余空间        ext4

有一个脚本工具可创建分区
$ cd ~/myandroid/
$ sudo chmod +x ./device/fsl/common/tools/fsl-sdcard-partition.sh
$ sudo ./device/fsl/common/tools/fsl-sdcard-partition.sh -f <soc_name> /dev/sdX
### <soc_name> can be as imx6q, imx6dl, imx6sl, and imx6sx.
### /dev/sdxN, the x is the disk index from 'a' to 'z'. That may be different on each Linux computer.
### Unmount all the SD card partitions before running the script.

----------------------------------------
4.1.2 Downloading images with MFGTool
simple and powerful
实际上是个垃圾工具,要到windows 下,还要连开发板
没干活先累半死。
----------------------------------------

----------------------------------------
4.1.3 Downloading images with dd utility
----------------------------------------
Download the U-Boot image:
$ sudo dd if=u-boot.imx of=/dev/sdx bs=1K seek=1; sync
Download the boot image:
$ sudo dd if=boot.img of=/dev/sdx1; sync
Download the Android system root image:
$ sudo dd if=system.img of=/dev/sdx5; sync
Download the Android recovery image:
$ sudo dd if=recovery.img of=/dev/sdx2; sync

------------------------------------------------------------
4.2 System on NFS
------------------------------------------------------------
甲:初始化
You must have a computer that has NFS and TFTP server,
with their root directory set up correctly, for example,
/opt/tftproot ##for TFTP root
/opt/nfsroot ##for NFS root.

乙: copy file
put the kernel image into the TFTP server root directory and
the Android file system files into the NFS server root directory
For kernel image, use uImage instead of zImage.
Copy uImage to the TFTP server root directory. For example:
$ cp your_uImage /opt/tftproot/

Set up the Android file system
For example:
$ cd /opt/android_KK4.4.3_2.0.0-ga_image_6qsabresd/NFS
$ tar xzvf ./android_fs.tar.gz
$ cd android_fs
$ rm -rf /opt/nfsroot/*
$ cp -r * /opt/nfsroot/*

for own image
$ cd ~/myandroid
$ rm -rf /opt/nfsroot/*
$ cp -r out/target/product/sabresd_6dq/root/* /opt/nfsroot/
$ cp -r out/target/product/sabresd_6dq/system/* /opt/nfsroot/system/

NOTE
Since the NFS uses system, data, and cache folders under /opt/nfsroot/,
we have to change some settings and command sequence in /opt/nfsroot/init.rc
and /opt/nfsroot/ init.freescale.rc.
Since the framework will clear Ethernet's IP when suspended, which
causes resume failure, the system property ethernet.clear.ip should be set to "no" in /opt/
nfsroot/init.rc. For example:

丙: u-boot加载文件, 建立环境参数
U-Boot > setenv get_cmd dhcp
U-Boot > setenv loadaddr 0x12000000
U-Boot > setenv bootfile zImage
U-Boot > setenv serverip 192.168.1.1
U-Boot > setenv nfsroot /opt/nfsroot
U-Boot > setenv bootcmd 'run netboot'
U-Boot > setenv fdt_file imx6q-sabredsd.dtb
U-Boot > setenv fdt_addr 0x18000000
U-Boot > setenv netargs 'setenv bootargs console=ttymxc0,115200 consoleblank=0 init=/init root=/dev/nfs rw ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp console=ttymxc0,115200 init=/init androidboot.console=ttymxc0 androidboot.hardware=freescale cma=384M'
U-Boot > setenv netboot 'echo Booting from net ...; run netargs;${get_cmd} ${bootfile };${get_cmd} ${fdt_addr} ${fdt_file};bootz ${loadaddr} - ${fdt_addr};'
U-Boot > saveenv
U-Boot > boot



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值