Bug#683329: flash-kernel: Toshiba AC100 support broken
On Sat, 2014-01-11 at 13:20 +0100, Vincent Zweije wrote: The proposed code just looks for a relatively distinctive pattern in the output. Empty output will certainly not match this pattern. I think adding an exit status check only serves to obscure what's actually going on. Actually I disagree, far from obscuring what is going on the use of error exist status is idiomatic in Unix shell. Given you analysis of the various error conditions (thank you) I think I will go with: || if ! abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null); then || continue || fi Ian. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#683329: flash-kernel: Toshiba AC100 support broken
I've just come across this old bug report and I'm wondering about the proposed patch. Is it correct to continue on through the body of the loop when that abootimg -i call has failed? I would expect that either there would be a continue or a -z check. Perhaps (untested): if ! abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null); then continue fi ? Or perhaps: abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || true) if [ -z $abootimg ]; then continue fi Or: abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || echo none) if [ $abootimg = none ]; then continue fi I'm not familiar with abootimg so I don't know what the expect failure modes actually look like. Ian. signature.asc Description: This is a digitally signed message part
Bug#683329: flash-kernel: Toshiba AC100 support broken
On Sat, Jan 11, 2014 at 11:08:22AM +, Ian Campbell wrote: || I've just come across this old bug report and I'm wondering about the || proposed patch. Is it correct to continue on through the body of the || loop when that abootimg -i call has failed? || || I would expect that either there would be a continue or a -z check. || Perhaps (untested): || if ! abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null); then || continue || fi || ? || || Or perhaps: || abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || true) || if [ -z $abootimg ]; then || continue || fi || Or: || abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || echo none) || if [ $abootimg = none ]; then || continue || fi || || I'm not familiar with abootimg so I don't know what the expect failure || modes actually look like. The manpage says nothing about abootimg failure modes. However, a little probing shows this: #abootimg -i /dev/mmcblk0p2 Android Boot Image Info: * file name = /dev/mmcblk0p2 [block device] * image size = 8388608 bytes (8.00 MB) page size = 2048 bytes * Boot Name = Ubuntu Boot Img * kernel size = 3161540 bytes (3.02 MB) ramdisk size = 2884017 bytes (2.75 MB) * load addresses: kernel: 0x10008000 ramdisk: 0x1500 tags: 0x1100 * cmdline = mem=448M@0M tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800 root=UUID=ae1a77f6-839f-4d0d-a196-31b1d421ab7a nosplash * id = 0x 0x 0x 0x 0x 0x 0x 0x #echo $? 0 #abootimg -i /dev/mmcblk0p2 | wc 22 73 608 #abootimg -i /dev/mmcblk0p3 /dev/mmcblk0p3: no Android Magic Value /dev/mmcblk0p3: not a valid Android Boot Image. #echo $? 1 #abootimg -i /dev/mmcblk0p3 | wc /dev/mmcblk0p3: no Android Magic Value /dev/mmcblk0p3: not a valid Android Boot Image. 0 0 0 # Conclusion: with correct argument, prints info on stdout, exit status 0 with wrong argument, prints nothing on stdout, exit status 1 Either result (output or exit status) can be used in this case. The proposed code just looks for a relatively distinctive pattern in the output. Empty output will certainly not match this pattern. I think adding an exit status check only serves to obscure what's actually going on. I'd really love this little trivial issue to be resolved, please. Vincent. -- Vincent Zweije vinc...@zweije.nl | If you're flamed in a group you http://www.xs4all.nl/~zweije/ | don't read, does anybody get burnt? [Xhost should be taken out and shot] |-- Paul Tomblin on a.s.r. signature.asc Description: Digital signature
Bug#683329: flash-kernel: Toshiba AC100 support broken [fix included]
Control: found -1 3.0~rc.2 Control: found -1 3.3+deb7u2 Control: found -1 3.11 Control: tag -1 + patch Control: severity -1 important Hi, Thomas Maass wrote: flash-kernel no longer flashs the Toshiba AC100 (Tegra2). It shows only Installing version... but no Flashing... The last version I remember to work was 3.0rc1. Actually it was 3.0~rc.1. And the first one which no more worked was 3.0~rc.2. Ran into that too when switching my AC100 from Ubuntu Precise to Debian Wheezy -- and it's still present in Debian Jessie/Sid. Vincent Zweije wrote: Trying to flash a new kernel failed - flash-kernel exits early because some shell command returned an error code. I have tracked this down to faulty boot device detection. This little loop from /usr/share/flash-kernel/functions around line 468 does the detection: for p in $android_boot_device*[0-9]; do abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null) image_size=$(abootimg_get_image_size $abootimg) if [ -n $image_size ] [ $image_size -gt $largest_size ]; then part=$p fi done The assignment to abootimg contains a call to abootimg -i $p. This call fails when the glob pattern on the line above returns a block device that is not an android boot image. Since the script is executed with -e, this aborts the script. Adding a || : after the command fixes the problem thus: for p in $android_boot_device*[0-9]; do abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || : ) image_size=$(abootimg_get_image_size $abootimg) if [ -n $image_size ] [ $image_size -gt $largest_size ]; then part=$p fi done I came to the same conclusion and patch: --- functions.orig 2013-10-25 13:58:31.379524139 +0200 +++ functions 2013-10-25 13:40:48.984844024 +0200 @@ -475,7 +475,7 @@ part= largest_size=-1 for p in $android_boot_device*[0-9]; do - abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null) + abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || true) image_size=$(abootimg_get_image_size $abootimg) if [ -n $image_size ] [ $image_size -gt $largest_size ]; then Tagging the bug report accordingly and raising the severity to important as this definitely affects all AC100 users. The probably easiest work-around (i.e. one which doesn't involve patching) is to use Julian's packages from http://people.debian.org/~jak/ac100/ which are apt-get-able. JFTR: Here's a condensed summary of what happens: # for i in /dev/mmcblk0p*; do echo $i; abootimg -i $i | fgrep 'image size'; abootimg -i $i /dev/null 21 ; echo $?; done /dev/mmcblk0p1 * image size = 5242880 bytes (5.00 MB) 0 /dev/mmcblk0p2 * image size = 8388608 bytes (8.00 MB) 0 /dev/mmcblk0p3 /dev/mmcblk0p3: no Android Magic Value /dev/mmcblk0p3: not a valid Android Boot Image. 1 ← This is where flash-kernel aborts due to set -e. /dev/mmcblk0p4 /dev/mmcblk0p4: no Android Magic Value /dev/mmcblk0p4: not a valid Android Boot Image. 1 /dev/mmcblk0p5 /dev/mmcblk0p5: no Android Magic Value /dev/mmcblk0p5: not a valid Android Boot Image. 1 /dev/mmcblk0p6 /dev/mmcblk0p6: no Android Magic Value /dev/mmcblk0p6: not a valid Android Boot Image. 1 /dev/mmcblk0p7 /dev/mmcblk0p7: no Android Magic Value /dev/mmcblk0p7: not a valid Android Boot Image. 1 # Regards, Axel -- ,''`. | Axel Beckert a...@debian.org, http://people.debian.org/~abe/ : :' : | Debian Developer, ftp.ch.debian.org Admin `. `' | 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE `-| 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#683329: flash-kernel: Toshiba AC100 support broken [fix included]
Package: flash-kernel Version: 3.2 Followup-For: Bug #683329 Dear Maintainer, This is probably the same bug, although the original report contains close to zero information... Trying to flash a new kernel failed - flash-kernel exits early because some shell command returned an error code. I have tracked this down to faulty boot device detection. This little loop from /usr/share/flash-kernel/functions around line 468 does the detection: for p in $android_boot_device*[0-9]; do abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null) image_size=$(abootimg_get_image_size $abootimg) if [ -n $image_size ] [ $image_size -gt $largest_size ]; then part=$p fi done The assignment to abootimg contains a call to abootimg -i $p. This call fails when the glob pattern on the line above returns a block device that is not an android boot image. Since the script is executed with -e, this aborts the script. Adding a || : after the command fixes the problem thus: for p in $android_boot_device*[0-9]; do abootimg=$(LC_ALL=C abootimg -i $p 2/dev/null || : ) image_size=$(abootimg_get_image_size $abootimg) if [ -n $image_size ] [ $image_size -gt $largest_size ]; then part=$p fi done -- System Information: Debian Release: wheezy/sid APT prefers precise-updates APT policy: (800, 'precise-updates'), (800, 'precise-security'), (800, 'precise'), (700, 'testing'), (650, 'unstable'), (600, 'stable') Architecture: armel (armv7l) Kernel: Linux 3.0.27-1-ac100 (SMP w/2 CPU cores; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to C.UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages flash-kernel depends on: ii devio1.2-1build1 ii initramfs-tools 0.99ubuntu13 ii linux-base 3.4ubuntu2 flash-kernel recommends no packages. Versions of packages flash-kernel suggests: ii u-boot-tools 2011.09-2 -- Configuration Files: /etc/initramfs/post-update.d/flash-kernel changed [not included] /etc/initramfs/post-update.d/zz-flash-kernel changed [not included] -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#683329: flash-kernel: Toshiba AC100 support broken
Package: flash-kernel Severity: normal flash-kernel no longer flashs the Toshiba AC100 (Tegra2). It shows only Installing version... but no Flashing... The last version I remember to work was 3.0rc1. -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-3-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org