Creating SD card from wandboard_lp-5.0.0 build

Discuss Android on the Wandboard, as well as app development for or on the Wandboard.

Creating SD card from wandboard_lp-5.0.0 build

Postby rdbirt » Fri Apr 10, 2015 2:14 am

i have built wandboard_lp-5.0.0_fullsource_20150213 and am now trying to create an SD card with it. it seems to be different from 4.2.2, at least as far as the boot files are concerned. is there any documentation on how to create an SD card with this new code?
rdbirt
 
Posts: 21
Joined: Wed Jan 07, 2015 5:36 pm

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby kensuke » Sat Apr 25, 2015 4:45 pm

backport info.
wandboard_lp-5.0.0_fullsource_20150422 to wandboard_lp-5.0.0_fullsource_20150213

1)
copy .git dir to /wandboard/external/chromium_org/third_party/angle
https://drive.google.com/file/d/0B1NZ-k ... sp=sharing

2)
copy logo and uenv dir to /device/wand/wandboard
(see attachment)

3)
new 20150422 archive contains flash sd script, and it's required one line adding.
before
Code: Select all
DEV_SD=$1
source build/envsetup.sh

after
Code: Select all
DEV_SD=$1
source build/envsetup.sh
lunch wandboard-user


4) flash system to sd
./create-android-sd.sh /dev/sdb

5) booting!!
not yet booted my environment... :evil:
Attachments
create-android-sd.sh
(1.39 KiB) Downloaded 196 times
device-wand-wandaboard-logo, uenv.zip
(19.78 KiB) Downloaded 177 times
kensuke
 
Posts: 14
Joined: Tue Mar 04, 2014 4:54 am

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby rdbirt » Tue May 05, 2015 2:55 am

Thank you, kensuke. I created my own script based on fsl-sdcard-partition.sh and create-android-sd.sh. I can post it if you'd like a copy.
rdbirt
 
Posts: 21
Joined: Wed Jan 07, 2015 5:36 pm

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby Ranjini » Tue May 05, 2015 9:08 am

Hi rdbirt

I have built the images from Wandboard lollipop source code.(wandboard_lp-5.0.0_fullsource_20150422)
Request you to kindly post your script files

Thanks
Ranjini
Ranjini
 
Posts: 12
Joined: Thu Apr 30, 2015 6:51 am

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby Ranjini » Wed May 06, 2015 7:41 am

hi rdbirt
I saw your post in Wandboard forms
I have successfully built the Wandboard lollipop code.
I am not able to boot the wandboard dual from the images. :(
kindly help me in this

I am pasting my script here...

/*********** Format the Sdcard before performing the following ***********************/
/*********** Partition The card and Mount it ***********************/
$ sudo fdisk -l (Find the card /dev)
$ sudo umount /dev/sdX
$ sudo dd if=/dev/zero of=/dev/sdX bs=1M count=1
$ sudo ./wand_fsl_sdcard-part.sh /dev/sdX /*use the script as it is*/

//One time creations..
sudo mkdir /media/one;


sudo dd if=SPL of=/dev/sdX bs=1k seek=1;
sudo sync;

sudo mount -t vfat /dev/sdX1 /media/one;
/*********** Flash the binary ***********************/
cd /home/ranjini/Wandboard/Android_Lollipop_Source_Code/wandboard_lp-5.0.0_fullsource_20150422/toflash;
sudo mkdir -p /media/one/boot;

sudo cp u-boot.img /media/one/boot/;
sudo sync
sudo cp kernel /media/one/boot/zImage;
sudo sync;
sudo cp imx6dl-wandboard.dtb /media/one/boot/;
sudo sync;
sudo cp uEnv.txt /media/one/boot/;
sudo sync;
sudo cp -rf logo /media/one/;
sudo sync;
mkimage -A arm -O linux -T ramdisk -C none -a 0x10800800 -n "Android Root Filesystem" -d ramdisk.img uramdisk.img
sudo cp uramdisk.img /media/one/boot/;
sudo sync;
sudo dd if=system.img of=/dev/sdX5;
sudo sync;

/*********** Resize the Android System ***********************/
sudo umount /dev/sdX*;
sudo resize2fs /dev/sdX5 760M;
sudo sync;

/*************************************************************/


Any help would be graetly appreciated

Thanks ranjini
Ranjini
 
Posts: 12
Joined: Thu Apr 30, 2015 6:51 am

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby rdbirt » Wed May 20, 2015 6:16 pm

hi ranjini,

here's the script i'm using. if you want to try it:

1. ensure you can run dd, sfdisk, umount, mount, mkfs.vfat, mkfs.ext4, mkdir, cp, e2fsck and resize2fs using 'sudo'
2. ensure remount of removable media is disabled

invoke the script with '-h' to see usage and options.

i found that when the SD card is booted u-boot is unable to find the device tree file. you can fix this from the u-boot prompt like this:

1. setenv fdt_file boot/imx6q-wandboard.dtb
2. saveenv
3. bootd

hope it helps.

Code: Select all
#!/bin/bash

# Partition sizes in MB
BOOTLOADER_RESERVE=8
BOOT_SIZE=100
TOTAL_BOOT=$((${BOOTLOADER_RESERVE}+${BOOT_SIZE}))
CACHE_SIZE=512
RECOVERY_SIZE=96
VENDOR_SIZE=8
MISC_SIZE=8

WAND_PATH=device/wand/wandboard
OUT=out/target/product/wandboard

NODE=""
PART=""

function help() {
    bn=`basename $0`
    cat << EOF
    usage: $bn <option> device_node
        options:
          -h  displays this help message
          -c  calculate partition sizes only
          -p  partition only
    invoke this script from the root of the Android source tree
EOF
}

function wipe_mbr_dev {
    sudo dd if=/dev/zero of=${NODE} obs=512 count=1
    if [ $? -ne 0 ]; then
        echo .
        echo . "Error writing MBR"
        exit 1
    fi
    sudo sfdisk --force --re-read ${NODE}
}

function partition_dev
{
    sudo sfdisk --force --unit M --no-reread ${NODE} << EOF
,${TOTAL_BOOT},c
,${RECOVERY_SIZE},83
,${EXTEND_SIZE},5
,${DATA_SIZE},83
,${SYSTEM_SIZE},83
,${CACHE_SIZE},83
,${VENDOR_SIZE},83
,${MISC_SIZE},83
EOF

    sudo sfdisk --force --unit M -N 1 --no-reread ${NODE} << EOF
${BOOTLOADER_RESERVE},${BOOT_SIZE},c
EOF

    sudo sfdisk --force --re-read ${NODE}
    sync
}

function umount_dev {
    sudo umount ${NODE}${PART}* > /dev/null 2>&1
}

function format_dev
{
    sudo mkfs.vfat -F 32 -n imx6 ${NODE}${PART}1
    sudo mkfs.ext4 -L rootfs ${NODE}${PART}2
    sudo mkfs.ext4 -L data ${NODE}${PART}4
    sudo mkfs.ext4 -L system ${NODE}${PART}5
    sudo mkfs.ext4 -L cache ${NODE}${PART}6
    sudo mkfs.ext4 -L vendor ${NODE}${PART}7
}

function write_dev {
    # create a temporary directory for mounting the boot partition
    mnt_dir=`mktemp -d`
    sudo mount ${NODE}${PART}1 ${mnt_dir}

    # create a boot directory
    sudo mkdir -p ${mnt_dir}/boot

    # write the environment files
    echo .
    echo . "writing environment files"
    echo .
    sudo cp ${WAND_PATH}/uenv/uEnv.txt ${mnt_dir}/boot/
    sudo cp -rf ${WAND_PATH}/logo ${mnt_dir}

    # 'cd' to the output directory
    cd ${OUT}

    # write boot loader to the bootloader reserved space
    echo . "writing bootloader"
    echo .
    sudo dd if=SPL of=${NODE} bs=1k seek=1

    # write u-boot and kernel files
    echo .
    echo . "writing u-boot and kernel files"
    echo .
    sudo cp u-boot.img ${mnt_dir}/boot/
    sudo cp kernel ${mnt_dir}/boot/zImage
    sudo cp imx6q-wandboard.dtb ${mnt_dir}/boot/

    # create and write ramdisk image
    echo . "creating and writing ramdisk image"
    echo .
    mkimage -A arm -O linux -T ramdisk -C none -a 0x10800800 \
        -n "Android Root Filesystem" -d ramdisk.img uramdisk.img
    sudo cp uramdisk.img ${mnt_dir}/boot/
    sync

    # umount the boot partition
    sudo umount ${mnt_dir}
    # remove temporary directory
    rmdir ${mnt_dir}
   
    # write the system image
    echo .
    echo . "writing system image"
    echo .
    sudo dd if=system.img of=${NODE}${PART}5
    sync

    # resize the system partition
    echo .
    echo . "resizing the system partition"
    echo .
    sudo e2fsck -f ${NODE}${PART}5
    sudo resize2fs ${NODE}${PART}5 $((${SYSTEM_SIZE}-1))M
}

# parse command line
moreoptions=1
calculate_only=0
partition_only=0
while [ "$moreoptions" = 1 -a $# -gt 0 ]; do
    case $1 in
        -h) help; exit 0 ;;
        -c) calculate_only=1 ;;
        -p) partition_only=1 ;;
        *)  moreoptions=0; NODE=$1 ;;
    esac
    [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit 1
    [ "$moreoptions" = 1 ] && shift
done

if [ -z ${NODE} ]; then
    help
    exit 1
fi

# if mmcblkX add "p" to partition names
echo ${NODE} | grep mmcblk > /dev/null
if [ "$?" -eq "0" ]; then
   PART="p"
fi

# get total capacity of the SD card and calculate some partition sizes
total_KB=`sudo sfdisk --no-reread -s ${NODE}`
if [ ! $? -eq 0 ]; then
    echo "    'sfdisk' cannot open ${1} for reading, please"
    echo "    note the following usage instructions:"
    echo
    help
    exit 1
fi

total_MB=$((${total_KB}/1024))
remaining=$((${total_MB}-${TOTAL_BOOT}-${RECOVERY_SIZE}-${CACHE_SIZE}\
           -${VENDOR_SIZE}-${MISC_SIZE}))
SYSTEM_SIZE=$((${remaining}/2))
DATA_SIZE=$((${remaining}-${SYSTEM_SIZE}))
EXTEND_SIZE=$((${SYSTEM_SIZE}+${CACHE_SIZE}+${VENDOR_SIZE}+${MISC_SIZE}))

# display partition sizes
echo "   TOTAL:$(printf "%7d" ${total_MB}) MB"
echo "    BOOT:$(printf "%7d" ${TOTAL_BOOT}) MB"
echo "RECOVERY:$(printf "%7d" ${RECOVERY_SIZE}) MB"
echo "    DATA:$(printf "%7d" ${DATA_SIZE}) MB"
echo "  SYSTEM:$(printf "%7d" ${SYSTEM_SIZE}) MB"
echo "   CACHE:$(printf "%7d" ${CACHE_SIZE}) MB"
echo "  VENDOR:$(printf "%7d" ${VENDOR_SIZE}) MB"
echo "    MISC:$(printf "%7d" ${MISC_SIZE}) MB"

if [ ${calculate_only} -eq 1 ]; then
    exit 0
fi

# do a sanity check on current directory and required files
if [ ! -e ${OUT}/SPL -o ! -e ${OUT}/kernel -o ! -e ${OUT}/system.img ]; then
    echo "    One or more required files cannot be found,"
    echo "    please note the following usage instructions:"
    echo
    help
    exit 1
fi

# ask user to verify
echo .
echo -n . "About to wipe ALL data on ${NODE}, enter 'Y' to proceed: "
read -r input
if [ ! "${input}" = "Y" ]; then
    echo .
    echo . "stop"
    echo .
    exit 0
fi
echo .

# wipe the current partition table on the SD card
wipe_mbr_dev

# write partition information to the SD card
partition_dev
if [ ${partition_only} -eq 1 ]; then
    exit
fi

# ensure partitions are not mounted
umount_dev

# format the new partitions
format_dev

# write the android images to the SD card
write_dev

exit 0
rdbirt
 
Posts: 21
Joined: Wed Jan 07, 2015 5:36 pm

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby jcsistemas2001 » Sat Aug 15, 2015 9:43 am

Dears,

In previous release (5.0.0) the script work perfect.

However, in release 5.0.2 the console show the next issue about system partition:

Code: Select all
...
EXT4-fs (mmcblk2p5): VFS: Can't find ext4 filesystem
fs_mgr: __mount(source=/dev/block/mmcblk2p5,target=/system,type=ext4)=-1
fs_mgr: Failed to mount an un-encryptable or wiped partition on/dev/block/mmcblk2p5 at /system options: (null) error: Invalid argument
EXT4-fs (mmcblk2p4): Ignoring removed nomblk_io_submit option
EXT4-fs (mmcblk2p4): recovery complete
EXT4-fs (mmcblk2p4): mounted filesystem with ordered data mode. Opts: nomblk_io_submit,noauto_da_alloc,errors=panic
fs_mgr: __mount(source=/dev/block/mmcblk2p4,target=/data,type=ext4)=0
EXT4-fs (mmcblk2p6): Ignoring removed nomblk_io_submit option
EXT4-fs (mmcblk2p6): recovery complete
EXT4-fs (mmcblk2p6): mounted filesystem with ordered data mode. Opts: nomblk_io_submit
fs_mgr: __mount(source=/dev/block/mmcblk2p6,target=/cache,type=ext4)=0
EXT4-fs (mmcblk2p7): mounted filesystem with ordered data mode. Opts: (null)
fs_mgr: __mount(source=/dev/block/mmcblk2p7,target=/device,type=ext4)=0
...


It seem the partition layout is different from previews version.

Any idea or suggestions to create the SD for 5.0.2?

Additional results:


Thanks
jcsistemas2001
 
Posts: 25
Joined: Thu Oct 17, 2013 5:53 am

Re: Creating SD card from wandboard_lp-5.0.0 build

Postby mindentropy » Wed Dec 16, 2015 8:17 am

It is not able to find mmcblk2p5. Can you post your fdisk -l?
mindentropy
 
Posts: 21
Joined: Sun Aug 31, 2014 9:32 am


Return to Software - Android

Who is online

Users browsing this forum: No registered users and 24 guests

cron