Hello, On Thu, Jun 23, 2011 at 05:01:19PM +0200, Julian Andres Klode wrote: > Package: flash-kernel > Severity: wishlist
Updated version after some IRC comments, for review: From 09e85bde46613216656c1cb9ea0c6eebb530701f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode <j...@debian.org> Date: Thu, 23 Jun 2011 17:52:47 +0200 Subject: [PATCH] flash-kernel: Add support for Toshiba AC100 and Android boot Introduce support for Android devices such as the Toshiba AC100 that boot from a special Android boot partition located on an internal eMMC. Status: early patch with known issues - bootimg.cfg is located in /boot - functions write to global variables - patch is completely untested Signed-off-by: Julian Andres Klode <j...@debian.org> --- flash-kernel | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/flash-kernel b/flash-kernel index bf5168e..487738b 100755 --- a/flash-kernel +++ b/flash-kernel @@ -251,6 +251,38 @@ nslu2_swap() { fi } +android_find_bootpart() { + for dev in $(ls ${ANDROID_MMC}?? 2>/dev/null); do + if abootimg -i $dev >/dev/null 2>&1; then + size=$(abootimg -i $dev |grep "image size"|cut -d ' ' -f5) + if [ $size -gt 5242880 ]; then + ANDROID_IMG=$dev + ANDROID_SIZE=$size + return 0 + fi + fi + done + return 1 +} + +android_build_bootimage() { + if [ -e /boot/bootimg.cfg ]; then + abootimg --create $TMPIMAGE -f /boot/bootimg.cfg -k $kfile \ + -r $ifile >/dev/null 2>&1 || return 1 + imagesize=$(wc -c "$TMPIMAGE" | awk '{print $1}') + check_size "Bootimage" $imagesize $ANDROID_SIZE + else + printf "Could not find /boot/bootimg.cfg." + return 1 + fi +} + +android_write_bootimage() { + printf "Writing boot image to $ANDROID_IMG ... " + dd if=$TMPIMAGE of=$ANDROID_IMG >/dev/null 2>&1 || return 1 + echo "done." >&2 +} + # somewhat RFC2822 based, but case sensitive, not tolerant to spaces etc. MACHINE_DB=" Machine: Buffalo Linkstation LiveV3 (LS-CHL) @@ -408,6 +440,9 @@ Kernel-Flavors: iop32x Machine-Id: 1101 Mtd-Kernel: kernel Mtd-Initrd: ramdisk + +Machine: Toshiba AC100 / Dynabook AZ +Boot-Type: Android " main() { @@ -476,6 +511,7 @@ umaddr="$(get_machine_field "$machine" "U-Boot-Multi-Address")" || : boot_kernel_path="$(get_machine_field "$machine" "Boot-Kernel-Path")" || : boot_initrd_path="$(get_machine_field "$machine" "Boot-Initrd-Path")" || : boot_multi_path="$(get_machine_field "$machine" "Boot-Multi-Path")" || : +boot_type="$(get_machine_field "$machine" "Boot-Type")" || : if [ -n "$mtd_kernel" ] || [ -n "$mtd_initrd" ]; then if [ ! -e "$PROC_MTD" ]; then @@ -522,6 +558,36 @@ cleanup_tmpdir() { trap cleanup_tmpdir EXIT HUP INT QUIT ILL KILL SEGV PIPE TERM tmpdir="$(mktemp -dt "$self.XXXXXXXX")" + +case "$boot_type" in + "Android") + ANDROID_IMG="" + ANDROID_SIZE="" + ANDROID_MMC="/dev/mmcblk0" + + TMPIMAGE=$(tempfile) + CONFIG="" + + if ! android_find_bootpart; then + rm -rf $TMPIMAGE + error "Could not find boot image partition on $ANDROID_MMC." + fi + + if ! android_build_bootimage; then + rm -rf $TMPIMAGE + error "Could not create temporary boot image." + fi + + if ! android_write_bootimage; then + rm -rf $TMPIMAGE + error "Can not flash to $ANDROID_IMG" + fi + + rm -rf $TMPIMAGE + ;; +esac + + case "$machine" in "Buffalo Linkstation LiveV3 (LS-CHL)" | "Buffalo Linkstation Mini" | "Buffalo Linkstation Pro/Live" | "Buffalo/Revogear Kurobox Pro" | "D-Link DNS-323" | "HP Media Vault mv2120" | "HP t5325 Thin Client" | "Marvell GuruPlug Reference Board" | "Marvell OpenRD Base Board" | "Marvell OpenRD Client Board" | "Marvell OpenRD Ultimate Board" | "Marvell SheevaPlug Reference Board" | "Marvell eSATA SheevaPlug Reference Board" | "QNAP TS-109/TS-209" | "QNAP TS-119/TS-219" | "QNAP TS-409" | "QNAP TS-41x" | "Seagate FreeAgent DockStar") kernel="$kfile" -- 1.7.5.4 -- Héctor Orón "Our Sun unleashes tremendous flares expelling hot gas into the Solar System, which one day will disconnect us." -- Day DVB-T stop working nicely Video flare: http://antwrp.gsfc.nasa.gov/apod/ap100510.html
signature.asc
Description: Digital signature