am335x Android EMMC mkmmc-android.sh hacking

Source: Internet
Author: User

# am335x Android EMMC mkmmc-android.sh hacking##1. Read the Android partition file in a moment. # 2. Code Source: https://github.com/hendersa/bbbandroid-external-ti_android_utilities/blob/master/am335x/mk-mmc/mkmmc-android.sh ##                                           .-9-8Shenzhen Nanshan Ping Shan Village Zengjianfeng #!/bin/bash# If there is only one parameter, this will exit directly Expected_args=1if[ $# ==$EXPECTED _args]then Echo"assuming Default Locations for prebuilt Images"    $0$1Boot_images/mlo boot_images/u-boot.img boot_images/zimage boot_images/uenv.txt Boot_Images/dtbs/ AM335X-BONEBLACK.DTB filesystem/rootfs*media_clips start_here exitfi# Six parameters, one can not be lessif[[-Z $1|| -Z $2|| -Z $3|| -Z $4|| -Z $5|| -Z $6]]then Echo"mkmmc-android Usage:"Echo"mkmmc-android <device> <MLO> <u-boot.img> <zImage> <uEnv.txt> < am335x-boneblack.dtb> <rootfs tar.bz2> <optional media_clips> <optional START_HERE folder>"Echo"EXAMPLE:MKMMC-ANDROID/DEV/SDC MLO u-boot.img zimage uEnv.txt am335x-boneblack.dtb rootfs.tar.bz2 media_clips START _here"exitfi# Determine if a file existsif! [[-E $2]]then Echo"Incorrect MLO location!"Exitfiif! [[-E $3]]then Echo"Incorrect u-boot.img location!"Exitfiif! [[-E $4]]then Echo"Incorrect zimage location!"Exitfiif! [[-E $5]]then Echo"Incorrect uEnv.txt location!"Exitfiif! [[-E $6]]then Echo"Incorrect am335x-boneblack.dtb!"Exitfiif! [[-E $7]]then Echo"Incorrect Rootfs location!"exitfi# tip Information echo"All data on"$1"Now'll be destroyed! Continue? [y/n]"Read ansif! [$ans = ='y']then exitfi# Uninstall all partitions mount Echo"[unmounting all existing partitions on the device]"Umount $1*Echo"[Partitioning $ ...]"# Erase partition Table Drive=$1DDif=/dev/zero of= $DRIVE bs=1024x768Count=1024x768&>/dev/NULL# Get information about EMMC size= ' Fdisk-l $DRIVE | grep Disk | Awk'{print $}'' echo DISK SIZE-$SIZE bytescylinders= ' echo $SIZE/255/ the/ +|BC ' # partition, and set boot partition echo cylinders-$CYLINDERS {echo,9,0x0C,*Echo, $ (expr $CYLINDERS/4),,-Echo, $ (expr $CYLINDERS/4),,-Echo,,0x0C,-} | Sfdisk-d-H255-S the-C $CYLINDERS $DRIVE &>/dev/NULLEcho"[Making filesystems ...]"if[[${drive} = =/dev/*Mmcblk*]] Then drive=${drive}pfi# formatted partition mkfs.vfat-f 32-n boot ${drive}1 &>/dev/nullmkfs.ext4-l rootfs ${drive}2 &&G T /dev/nullmkfs.ext4-l usrdata ${drive}3 &>/dev/nullmkfs.vfat-f 32-n data ${drive}4 &>/dev/nullecho "[Cop Ying files ...] " # mount and copy files to partition 1mount ${drive}1/mntcp $2/MNT/MLOCP $3/MNT/U-BOOT.IMGCP $4/MNT/ZIMAGECP $5/MNT/UENV.TXTMKDIR/MNT/DTBSCP $6/mnt/dtbs/am335x-boneblack.dtbif ["$9"]then echo "[Copying start_here folder to boot partition]" Cp-r $9/mnt/start_herefi# unmount partition umount ${drive}1# Copy file system contents to partition 2mount ${drive}2/mnttar jxvf $7-c/mnt &>/dev/nullchmod 7 55/mntumount ${drive}2# copy data to partition if ["$8"]then echo "[Copying all clips to data partition]" Mount ${drive}4/mn T cp-r $8/*/mnt/umount ${drive}4fiecho "[Done]"

am335x Android EMMC mkmmc-android.sh hacking

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.