This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Install Android boot image in NAND flash over USB

Hello

I made my own ANDROID ICS device by the reference of Beagelbone Rev A5 with little modification. Modifications are

1. I am using NAND for installing boot image behalf of SD card.

2. I had disconnect the SD card, rite now my device don't have SD card functionality and hardware support too.

Now the problem is, i cant install the boot image from AOSP ( Image_folder) to NAND flash. So i need advice for following issues

1. How to build NAND supporting android image.

2. How to install android image in NAND over USB, not from SD card.

Can any one help me.?

Note: I already referred http://e2e.ti.com/support/embedded/android/f/509/t/202209.aspx post, there is no matter form me except UBIFS creation. There is information for booting from SD card. and not about how to Build NAND supported boot image form AOSP. So please don't switch me into that post.!

I need brief idea about NAND installing 

Thanks in advance.

  • We generally recommend to use SD card as boot device at least during development stages.

    Currently the TI Android DevKit only supports flashing NAND using u-boot loaded from SD card.

  • So it's absolutely impossible to boot and manage OS, completely from NAND Flash? I need SD-Cardless operation. There is no any way?

  • Forget my last thread.

    I'm able to work with NAND completely. I can remove Sd-Card. Anyway. This good for my product.

    So my new questions are;

    * Is it possible to copy NAND image from different source? Like USB device and Host Based Flash Downloader.

    * Is it possible to copy any files from any source to NAND Flash based File system's "data" directory. (Maybe i can give the answer on today with my effort.)

    Many Thanks

    Babur

  • Hi Bahabur,

    Could you please share me the way to flash boot-loaders images to NAND without SDcard?

    Did you boot over USB or UART?

    THanks for help!

    JPhan

  • MAKE FS TARBALL 

    type following

      make TARGET_PRODUCT=<product name> fs_tarball</code>

     

    to create Manual,

    $ cd out/target/product/<product-name>
      $ mkdir android_rootfs
      $ cp -r root/* android_rootfs
      $ cp -r system android_rootfs
      $ ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs.tar.bz2

    Product-name = “am335xevm” 

    This will create "android_rootfs". We will create an ubi.img. MTD Util will help us.

     

    Create UBIFS image

    make permissions to release

       $ sudo chmod -R 777 android_rootfs

     

    Download MTD Utils

    MTD util’i indir. You must download 3 libraries.

    Those; zlib, lzo and e2fsprogs

    for ZLIB Zlib’i http://zlib.net

    for Lzo  http://www.oberhumer.com.opensource/lzo/download 

    for E2fsprogs http://e2fsprogs.sourceforge.net 

    Copy all of them to  "/home/mtd/install" folder

    And for ZLIB 

      host$ tar xvf zlib-1.2.5.tar.gz

        host$ cd zlib-1.2.5/

        host$ ./configure --prefix=/home/user/mtd/install

        host$ make

        host$ make install

        host$ cd ..

     for LZO

       host$ tar xvf lzo-2.06.tar.gz
        host$ cd lzo-2.06/
        host$ ./configure --build=i686-pc-linux --prefix=/home/user/mtd/install
        host$ make
        host$ make install
        host$ cd ..

    for 

    E2fsprogs 

      host$ tar xvf e2fsprogs-1.42.tar.gz
        host$ cd e2fsprogs-1.42/
        host$ ./configure --build=i686-pc-linux --prefix=/home/user/mtd/install 
        host$ make
        host$ make install
        host$ cd lib/uuid/
        host$ make install
        host$ cd ../../../

    Those steps will create some files on some folders. And 

    Download  http://git.infradead.org/mtd-utils.git/snapshot/d37fcc0afd0d4a14c56812847e8e4257d0a99e3b.tar.gz (--> mtd-utils-d37fcc0.tar.gz)

    Now we are ready.

     

    in "Mtd-utils" folder

      $ tar xvf mtd-utils-d37fcc0.tar.gz
      $ cd mtd-utils-d37fcc0/

    Then

    Edit "makefile" file and add following lines to "Top"

        host$ vi Makefile
               PREFIX = /home/user/mtd/install
               ZLIBCPPFLAGS = -I$(PREFIX)/include
               LZOCPPFLAGS = -I$(PREFIX)/include
               ZLIBLDFLAGS = -L$(PREFIX)/lib
               LZOLDFLAGS = -L$(PREFIX)/lib
               LDFLAGS += $(ZLIBLDFLAGS) $(LZOLDFLAGS)
               CFLAGS ?= -O2 -g $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
               CROSS=arm-none-linux-gnueabi-

     

    Then open common.mk and commen out  “PREFIX=/usr” line

    And complie like this
        $ WITHOUT_XATTR=1 make
        $ make install  DESTDIR=/home/user/mtd/install
        $ cd ..

    If you have any error; this mean any of 3 libraries compiling had a problem. Compile all for sure.

    Now MTD-util is ready

     

    for Ubifs.img 

    in "Mkfs.ubifs" folder

       $  ./mkfs.ubifs -r <path-to-rootfs>/ -F -o ubifs.img -m 2048 -e 126976 -c 1580

    This will make all things we need automaticly.

    Then cut "ubifs.img" file from here and put "ubi-utils" folder.

    Also in this folder, create a file named "ubinize.cfg”

    and add followings

       [ubifs]
        mode=ubi
        image=ubifs.img
        vol_id=0
        vol_size=192MiB
        vol_type=dynamic
        vol_name=rootfs
        vol_flags=autoresize

     

    After to create "ubi.img" file;

       $ ./ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
    (make sure page and subpage parameter)

    Now all files are ready.

    Copy all files to any folder. for ex: AM335xEVM

    Plug any SD-MMC card to your pc. (this probably named "sdb")

    Then

      $ cd <Board name>

      $ sudo ./mkmmc-android-ubifs.sh /dev/sd<device>

    This will copy the NAND images to our exchange SD-Card

    Finally,

    Put this sd card to your eval board and configure board to boot from sdcard.

    in u-boot prompt, (hyperterminal window)

    hit any key and type

    #boot 

    and enter. This step will copy nandimages, from sdcard to NAND flash.

    I know this is bad way for manufacturing. Also there are some more method to copy nand images. I didn't success. It uses UART and terminal x-modem file transfer methods and takes ages.

    :)

  • Hi,

    Thank you for sharing!

    Your way still need a boot-able SD card.

    I need a way that can flash images to NAND without u-boot loaded from SD card.

    Actually, I used method of booting over UART. I tried omap-u-boot-utils from Nishanth Menon, but I got failed at using "ukemit" (error "Failed after 4 retries in sequence...")

    Is there anyone facing same my issue?

    Thank you,

    JPhan

  • Yes you need NAND flasher SD and of course sd-card slot. But you can use portable SD card slot. If you make another small circuit which contains sd-card slot, some bypass capacitors and a 9 pin IDC to connect mainboard then you can apply this method to all your mass manufactured Mainboards. (You need sdcard just for one time)

    Also the NAND flash writing is very clear. There are some NAND flasher utility for TSOP-48's. If you have binary files and you know what it's starting address then okay. Look at NAND-Flasher utilities and programming adapters. (of course this can change production process, so u must flash all your NAND before populate)

    3 months ago, i searched same resolve like this. Completely same.

    But for the AM335x and Android, NOTHING! We can't flash NAND from USB. There is no any tool.

    Thanks