Differences between revisions 7 and 8
Revision 7 as of 2009-10-17 19:49:46
Size: 8628
Editor: OsamuAoki
Comment:
Revision 8 as of 2009-10-20 14:22:18
Size: 2362
Editor: OsamuAoki
Comment:
Deletions are marked like this. Additions are marked like this.
Line 54: Line 54:
This will let you create microSD on your normal Debian PC's USB connected reader:
{{{
#!/bin/sh
#
# This Netwalker PC-Z1 recovery boot image download ustility is
# for console with root privilege on any modern Linux system.
# URL data etc. are based on version: 1.020 by Sharp recovery.sh
#
# (c) Osamu Aoki osamu@debian.org, GPL 2.0+

#set -x
set -e

# Data taken from version: 1.020 by Sharp recovery.sh source

# minimum size needed to store the recovery system data
# This can be overriden by environment variables.
MSIZE=${MSIZE:-1921024}

# /dev/mmcblk0p1 is normally mounted to /media/disk on netwalker system
# if microSD card is inserted after boot.
# This can be overriden by environment variables.
MMOUNT=${MMOUNT:-/media/disk}

# root directory to keep firmware
FIRMWARE="firmware"
# Binary kernel image in zImage format
ZIMAGE="zImage"
# Name of /boot
BOOT="boot"

# About 80 MB of small filesystem for filesystem
DL_HTTP1="http://mit.sharp.co.jp/"
DL_FILE1="os.tar.bz2"

# About 2.1MB for kernel
DL_HTTP2=$DL_HTTP1
DL_FILE2="zImage"

# About 975MB for ubi image (flash initialization?)
DL_HTTP3=$DL_HTTP1
DL_FILE3="ubi.img"

#######################################################################
# This is start of subroutin programs
#######################################################################

function confirm() {
 printf "%s" "$1"
 read x
 case "x$x" in
 x)
  return 0
  ;;
 xy|xyes|xY|xYES|xYes)
  return 0
  ;;
 xn|xno|xN|xNO|xNo)
  return 1
  ;;
 esac
 return 1
}

# standard routines
function xecho() {
 case $1 in
 YN|yn|Yn)
  # print and confirm and exit
  if confirm "$2 (Y/n):" >&2 ; then
   return 0
  else
   return 1
  fi
  ;;
 confirm|prompt)
  # print and confirm
  confirm "$2 (RETURN to continue):" >&2 || true
  return 0
  ;;
 info)
  # print and go on ...
  printf "%s\n" ">INFO: $2" >&2 || true
  return 0
  ;;
 warn)
  # print and confirm
  confirm ">>WARN: $2 (RETURN to continue):" >&2 || true
  return 0
  ;;
 error)
  # print and confirm and exit
  printf "%s\n" ">>>ERROR: $2" >&2
  exit 1
  ;;
 *)
  echo "BUGGY: xecho $1 $2" >&2
  exit 1
  ;;
 esac
}

function xunmount(){
 # Some automounter might have mounted it. unmount now.
 if mount -l | fgrep --color=never $1 >/dev/null ; then
  umount -l $1
 fi
}

function webget(){
 # this could be curl
 wget --no-cache $1
 if [ $? -ne 0 ] ;then
  xecho error "failed to download from $1"
 fi
}


#######################################################################
# This is start of main program
#######################################################################

# Sanity check: being root
if [ "$(id -u)" != 0 ]; then
 xecho error "You have to have root privilege."
fi

# quick guess for machine architecture
if [ `uname -m` = "armv7l" ] ; then
 xecho info "You are on armv7l and we assume you are running this under netwalker."
 MACHINE="netwalker"
else
 xecho info "You are not on armv7l and we assume you are running this not under netwalker."
 MACHINE="other"
fi

if [ $MACHINE = "netwalker" ]; then
 # /dev/mmcblk0 for netwalker internal micro SD"
 # This can be overriden by environment variables.
 MDEV=${MDEV:-/dev/mmcblk0}
 MPART=${MPART:-/dev/mmcblk0p1}
else
 # This is used if this microSD card is attached via USB card reader
 # your main system HDD is on /dev/sda
 # USB connected drive on /dev/sdb will be wiped.
 # This can be overriden by environment variables
 # if your USB microSD card reader is not at /dev/sdb
 MDEV=${MDEV:-/dev/sdb}
 MPART=${MPART:-/dev/sdb1}
fi

# Report device situation to user
xecho info "Following devices are in use:"
mount -l | grep --color=never "^/dev/" >&2
if mount -l | fgrep --color=never $MDEV >/dev/null ; then
 xecho error "Removable media $MDEV should not be mounted."
fi

# User confirmation
if xecho yn "Will you make recovery mocroSD card?" ;then
 xecho info "Pressed OK. Now we are making bootable recovery microSD ..."
else
 xecho error "Stoped here. We are not maiking recovery microSD."
fi

xecho prompt "Please insert microSD now."
sleep 1
sync

# Some automounter might have mounted it. unmount now.
xunmount $MDEV

# Get last minutes confirmation to fdisk/mkfs $MDEV
xecho confirm "Formatting microSD. All data on $MDEV will be lost ..."

xecho info "Make only $MPART on $MDEV for Linux ext2. (Not vfat)"
# partition microSD <start>=0 <size>=all <id>=(LINUX_NATIVE (83))
sfdisk -q $MDEV -uM << EOF
0,,L
EOF

sync

# Some automounter might have mounted it. unmount now.
xunmount $MPART

xecho info "Make ext2 filesystem on $MPART."
mke2fs $MPART

# Some automounter might have mounted it. unmount now.
xunmount $MPART

# make unused mount point for microSD card
MCARD=$MMOUNT
for COUNT in 0 1 2 3 4 5 6 7 8 9 "END"; do
 if [ $COUNT = "END" ]; then
  xecho info "You may need to clean files $MMOUNT-*."
  xecho error "failed to make mount point starting: $MMOUNT"
 fi
 MCARD=${MMOUNT}-${COUNT}
 if [ ! -d $MCARD ]; then
  break
 fi
done
mkdir -p $MCARD

xecho info "mounting $MPART at $MCARD"
mount $MPART $MCARD

if [ $? -ne 0 ] ; then
 umount -l $MPART
 xecho error "Can not mount $MPART on $MCARD."
fi

# cd into mount point of microSD device
OLDDIR=$(pwd)
cd $MCARD
xecho info "change directory from $OLDDIR to $MCARD"

# download os.tar.bz2
webget $DL_HTTP1$DL_FILE1

# expand os.tar.bz2 at root of microSD partition1 (ext2)
tar xvfj $DL_FILE1
 
if [ ! -d $FIRMWARE ] ; then
 mkdir -p $FIRMWARE
fi

cd $FIRMWARE
xecho info "change directory to $(pwd)"
if [ -e $DL_FILE2 ] ; then
 rm -f $DL_FILE2
fi
# download to zImage to /firmware/
webget $DL_HTTP2$DL_FILE2

if [ -e $DL_FILE3 ] ; then
 rm -f $DL_FILE3
fi
# download ubi.img to /firmware/
webget $DL_HTTP3$DL_FILE3
xecho info "download completed"

# back from $FIRMWARE to mount point of microSD
cd ..
xecho info "change directory to $(pwd)"

xecho info "copy $DL_FILE2 in $FIRMWARE to $ZIMAGE in /$BOOT"
cp -fv $FIRMWARE/$DL_FILE2 $MCARD/$BOOT/$ZIMAGE
xecho info "$ZIMAGE copied."

cd $OLDDIR
xecho info "change directory to $(pwd)"

xecho info "sync devices before unmounting."
sync

xecho info "umounting microSD card partition: $MPART"
umount -l $MPART

xecho info "removing mount point: $MCARD"
rm -rf $MCARD

# Complete
xecho info "Recovery microSD has been created."

}}}
This will let you create microSD on your normal Debian PC's USB connected reader (This is tested to download files but so fat, I have not used to re-install system yet): [[http://people.debian.org/~osamu/pub/spider-recovery|spider-recovery]]

Translation(s): none

(!) ?/Discussion

DebianOn is an effort to document how to install, configure and use Debian on some specific hardware. Therefore potential buyers would know if that hardware is supported and owners would know how get the best out of that hardware.

The purpose is not to duplicate the Debian Official Documentation, but to document how to install Debian on some specific hardware.

If you need help to get Debian running on your hardware, please have a look at our user support channels where you may find specific channels (mailing list, IRC channel) dedicated to certain types of hardware.

Models covered
PC-Z1 ?NetWalker

Sub-models :
- Video card
- Screen size (5" WSVGA (1024x600) touchscreen)
- Wireless card

Overall Status

Kernel and user land source

Ubuntu kernel provided is patched. You need to use it for now.

You can get kernel and other sources from:

deb-src http://ports.ubuntu.com/ubuntu-ports jaunty main universe
deb-src http://netbook-remix.archive.canonical.com/updates/dists/jaunty-araneo/ jaunty main universe

Bootloader hints

It seems this uses Redboot.

os.tar.bz2 (See below for recovery script) has initialization script as a part of sysv-intit.

/etc/rc2.d/S01upfirm calling a program /usr/local/bin/update_spider.sh.

At least by hacking this image, you can install Debian using debootstrap.

Comments in update_spider.sh start as:

#   spider.srp
#    6,rootfs.jffs2   (RFS jffs2)
#    5,ubi.img        (RFS ubifs)
#    4,zImage         (Kernel)
#    3,info.bin       (System information)
#    2,fis.bin        (Redboot fis)
#    1,redboot.bin    (Redboot)

Recover script for Debian

This will let you create microSD on your normal Debian PC's USB connected reader (This is tested to download files but so fat, I have not used to re-install system yet): spider-recovery