#!/usr/bin/kermit + # # Copyright (c) 2007 Tobias Rautenkranz # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # # Load a kernel image over /dev/ttyS0 into the RAM of a DS-101g+ # and boot it. Does not write it to flash. # # usage: ./image.ksc uImage [initrd] # # http://tobias.rautenkranz.ch/ds101g+ if ( < \v(argc) 2 || > \v(argc) 3 ) { echo usage: \%0 uImage [initrd] exit 1 } if not exist \%1 exit 1 \%1: no such file local initrd if ( = \v(argc) 3 ) { assign initrd 1 if not exist \%2 exit 1 \%2: no such file } else { assign initrd 0 } local uimage-offset inird-offset assign uimage-offset "0x0800000" assign initrd-offset "0x0900000" set line /dev/ttyS0 # change if needed set speed 115200 set carrier-watch off set flow-control none robust set file type bin set file name lit set rec pack 1000 set send pack 1000 set window 5 LINEOUT version input 1 _MPC824X > if fail { echo waiting for ppcboot (please power cycle / reboot the Diskstation) input 15 Press space to abort autoboot in 1 second if fail stop 1 Failed to interrupt boot output \32 input 2 _MPC824X > if fail stop 1 No prompt } # # protect flash (there is no such thing as being too careful) # LINEOUT protect on all echo uploading kernel image: \%1 LINEOUT loadb \m(uimage-offset) send \%1 if fail stop 1 upload kernel image failed if ( initrd ) { input 2 _MPC824X > if fail stop 1 No prompt echo uploading initrd: \%2 LINEOUT loadb \m(initrd-offset) send \%2 if fail stop 1 upload initrd failed } # # verify # input 2 _MPC824X > if fail stop 1 No prompt LINEOUT iminfo \m(uimage-offset) input 5 Verifying Checksum ... OK if fail stop 1 kernel image Checksum fail if ( initrd ) { input 2 _MPC824X > if fail stop 1 No prompt LINEOUT iminfo \m(initrd-offset) input 5 Verifying Checksum ... OK if fail stop 1 initrd Checksum fail } # # boot # input 2 _MPC824X > if fail stop 1 No prompt if ( initrd ) { LINEOUT bootm \m(uimage-offset) \m(initrd-offset) } else { LINEOUT bootm \m(uimage-offset) } connect