Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was getting one program for partitioning SD card.I have given that script below:

#!/bin/sh
if [ $# -lt 2 ]; then
   echo "example usage: $0 /dev/sdc \$ANDROID_ROOT"
   exit 1
fi

DRIVE=$1
ANDROID_ROOT_DIR=$2

sudo umount ${DRIVE}*

sudo dd if=/dev/zero of=$DRIVE bs=1 count=1024
sudo sync
sudo parted $DRIVE mklabel gpt
sudo parted $DRIVE mkpart boot fat32 1MB 9MB
sudo parted $DRIVE mkpart system ext4 9MB 521MB
sudo parted $DRIVE mkpart cache ext4 521MB 1033MB
sudo parted $DRIVE mkpart userdata ext4 1033MB 2033MB
sudo parted $DRIVE mkpart media fat32 2033MB 3033MB
sudo sync

sudo mkfs.ext4 ${DRIVE}2 -L system
sudo mkfs.ext4 ${DRIVE}3 -L cache
sudo mkfs.ext4 ${DRIVE}4 -L userdata
sudo mkfs.vfat -F 32 ${DRIVE}5 -n media
sudo sync

sudo dd if=${ANDROID_ROOT_DIR}/device/ti/panda/xloader.bin of=$DRIVE bs=131072 seek=1
sudo sync
sudo dd if=${ANDROID_ROOT_DIR}/device/ti/panda/bootloader.bin of=$DRIVE bs=262144 seek=1
sudo sync
sudo dd if=${ANDROID_ROOT_DIR}/out/target/product/panda/boot.img of=${DRIVE}1
sudo sync
${ANDROID_ROOT_DIR}/out/host/linux-x86/bin/simg2img ${ANDROID_ROOT_DIR}/out/target/product/panda/system.img ${ANDROID_ROOT_DIR}/out/target/product/panda/system.ext4.img
sudo dd if=${ANDROID_ROOT_DIR}/out/target/product/panda/system.ext4.img of=${DRIVE}2
sudo sync
sudo e2label ${DRIVE}2 system
sudo sync

I know that while executing this .sh file, the content will be running on linux. Even though I can understand the program, I am having doubt on one line:

 ${ANDROID_ROOT_DIR}/out/host/linux-x86/bin/simg2img ${ANDROID_ROOT_DIR}/out/target/product/panda/system.img ${ANDROID_ROOT_DIR}/out/target/product/panda/system.ext4.img

Please anyone can explain what happens in this line? there is no linux command, then how can it run without error?

And another doubt is:

This code parted DRIVE as 5 partition as boot, system, cache, userdata and media. But why does boot not created? that is, {DRIVE}1 is not set know? Then where will be xloader.bin, bootloader.bin and boot.img all stored?

share|improve this question

2 Answers 2

This line instructs the shell, which runs the script, to start a binary called simg2img located in directory ${ANDROID_ROOT_DIR}/out/host/linux-x86/bin/ providing it with two parameters, ${ANDROID_ROOT_DIR}/out/target/product/panda/system.img and ${ANDROID_ROOT_DIR}/out/target/product/panda/system.ext4.img.

In fact, almost every line of your script are similar to this one, the only difference is that a sudo binary is started.

share|improve this answer
    
shall i know the work of simg2img? –  Dhasneem Feb 13 '13 at 7:20
    
According to search results provided by a major Internet search service, it's an utility to do something particularly useful with ROM images. But that is a completely different topic. –  Leonid Feb 13 '13 at 7:27
    
what will this command do in this code? –  Dhasneem Feb 13 '13 at 7:31
1  
Unfortunately, I am not able to answer beyond "It will launch that binary". I would advise you to look for the documentation on this tool, it's definitely not something common in UNIX or Linux. –  Leonid Feb 13 '13 at 10:10
    
ok Sir. Thank u so much! –  Dhasneem Feb 13 '13 at 10:14

The command is simg2img. The rest is the path to the executable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.