SBOOT(10.8) (Strongarm) SBOOT(10.8) NAME sboot - SA110 and SA1100 bootstrap program SYNOPSIS From armsd, rdp, or exported styxmon connection: .}f load sboot go DESCRIPTION Sboot is a standalone executable for the StrongARM architec- tures (SA110 and SA1100) that loads and starts a program in Inferno boot format (for the ARM, this is either an AIF or Plan9-style executable). Sboot loads the program at the entry address specified by the header, usually `0x8000' on the SA1100. After loading, control is passed to the entry location specified in the executable's header. Loading sboot from armsd If a board with the old Demon-based monitor is being used, there are at least four ways that sboot can be loaded from the ARM debugger armsd. If the sboot binary file resides on the host in the current directory, it can be loaded with: load sboot go If sboot has already been loaded into the flash memory or ROM at its default offset (`0x8000' on the SWoRD board), then this shortcut can be used: pc=0x40 go If sboot has been loaded into the flash memory or ROM at a different address, then the following sequence can be used: r0=<offset of sboot> pc=0x48 go Finally, if the system has been set up to autoboot, by setting the autoboot vector (described with the P command, below), then sboot will be run automatically upon booting and will attempt to load the kernel automatically. After sboot is started, unless it is in autoboot mode, a command prompt (`>>>') will appear on the debugger Page 1 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) console. Loading sboot from rdp With rdp, a small armsd replacement that runs under Inferno, sboot will automatically start unless the -c option is given to rdp. If the -c option is used (`enter command mode'), the `sb' mash(1) command provided in /usr/ddk/lib/mashinit can be used to start sboot. Alternatively, use the same commands as with armsd. Loading sboot from Styxmon From styxmon(10.8), there are several ways to load sboot. All of the following examples assume that styxmon has been mounted on `/n/rdbg'. If the sboot binary file resides on the host, it can be simply be copied to `/n/rdbg/boot' to have it copied onto the board and started. If sboot has already been loaded into the flash memory or ROM at its default offset (0x8000 on the SWoRD board), then it can be executed with: echo E > /n/rdbg/ctl If sboot has been loaded into the flash memory or ROM at a different address, then the following sequence can be used: echo E0xoffset >/n/rdbg/ctl Finally, if the system has been set up to autoboot, by setting the autoboot vector (described in the P command, below), then sboot will be run automatically upon booting and will attempt to load the kernel automatically. After loading sboot via styxmon(10.8), it will export the flash partitions into the namespace, with names such as /n/rdbg/flash0sboot. These files can be copied to and from like ordinary files. It will also export a temporary device, called `/n/rdbg/tmp' which is mirrored by the T! device discussed below. File and Device Names From the sboot shell prompt, most commands will take file- names as arguments. Filenames can represent devices, or files in the more traditional sense, but in either case a device is always specified. Most filenames are in the form device!unit!file. Some devices have the simpler form device!file, or device!argument. This format is used to be consistent with the Inferno boot loaders on other platforms. Page 2 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) Supported devices are: m!address Memory. The single argument tells the base address to start at, and defaults to 0 if omitted. Z[!number] Zero device. The single optional argument tells the number of zeros to supply, otherwise an infinite source is available. This is useful for clearing areas of memory, disk blocks, partition tables, etc. D!debug_file The host debugger file system. The unit is omitted, and the file represents a file on the host machine. These host files are accessed internally via the bootparam interface (see /os/sa1100/bootparam.h). The `D!' device can only be used on Demon-based systems, and will not work on Styxmon-based systems. On systems with Styxmon, use the `T!' device instead, or directly access the exported flash partitions. F!partition_name Flash memory. The unit can be either the number or name of a partition, where `all' is the entire flash, and `partition' is the partition table. T! Temporary file. This exists only for styxmon-based boards. It will grow as needed, and can be referred to as T! (from sboot commands), or when mounted as /n/rdbg/tmp. When accessed from sboot, shell commands, filenames may optionally be followed by an offset and/or a length, in the following format: filename@offset [,length] The length is relative to the starting offset. If an offset and/or length is given and no device/filename is specified, then the m memory device is used by default. Examples can be found at the end of this document. Commands The following commands are available (listed in alphabetical order): ? List commands, showing for each command: the command character, the minimum and maximum number of argu- ments, and a short description. > [v|d] Page 3 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) Redirect output to video (v), or debugger (d). < [k|d] Redirect input from keyboard (k), or debugger (d). = List all environment variables. Those with asterisks to the left of them are pseudo-variables that have special meaning, and aren't passed on to programs as part of the environment. variable=value Set a variable to the specified value, which can be either a string or number depending upon the meaning of the variable. Variables can be substituted into the command line using `$variable', similar to many shell programs. B Show BootParam information. b[ file ][ args ] ... Boot from the specified file/device. Boot arguments are optional. The file to boot from is optional, and if it is not specified, the command b $bootfile $bootargs will be substituted, using the bootfile and bootargs environment variables. If the boot file is not specified, and the variable bootfile is not set, an error will be reported. The boot file can be com- pressed, using gzip format, and will be automati- cally uncompressed prior to execution. csrc dest Copy a file from the source to the destination. A dash (-) can be specified to mean either standard input for the source, or standard output for the destina- tion. c/usrc dest Copy a compressed file from the source to the destina- tion, uncompressing it before writing it. This takes a file that was compressed using the gzip format. D addr value Deposit the given 32-bit value at the specified address. d file val ... Deposit one or more values into the given file or device, using 32-bit words. E addr Examine the 32-bit word at the specified address. Page 4 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) e file Examine the specified file, using both hex (in 32-bit words) and ascii formats. P List partition table. This shows, for each par- tition, the partition device number, the starting offset, the total size, permissions, flags, and name. It also shows the autoboot offset. Note that if flash memory exists, F!all exists, and represents the entire flash memory. Also, if an area has been set aside for a partition table, then F!partition rep- resents that area. All other partitions are reconfigurable. P/a number Enable/disable autoboot. Given a partition device number, this will set autoboot to occur from the specified partition. This will also set the internal vector used for finding sboot in debug mode. Setting this to 0 will disable autoboot, but will not change the internal sboot vector. Generally, the partition holding sboot should be used for autobooting. WARNING: setting this to anything other than 0 or the sboot partition may make the flash unusable, and might require using an EEPROM burner to reprogram the flash. Even setting the autoboot to load sboot could be dangerous. The autoboot sequence should first be tested with the A command to make sure it behaves as expected, and also to make sure that some means of disabling it is accessible. P/d number Delete the specified partition. P number start size perm flags name Create a partition. The permissions are specified in octal as standard Inferno-style permissions (see sys- stat(2)). Generally, the flags should be set to 0. P/m Show a map of the entire flash, with sectors, offsets, and sizes, and whether or not the sector is pro- tected. Sector protection information is not avail- able on all flash devices. P/u number Unprotect the sectors for the specified partition. Changing sector protection is not available on all flash devices. P/p number Protect the sectors for the specified partition. Page 5 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) Changing sector protection is not available on all flash devices. S file Stat a file. Get information about the requested file or device. T[repeat] Show title. This will cycle through the standard title startup sequence. Given a non-zero parameter, it will cycle indefinitely. Autoboot When the autoboot vector is set in the flash to run sboot automatically (using the P command), sboot will first cycle through the title sequence, and then try to boot from the file specified by the bootfile environment variable, as if the following commands had been typed: T 0 b $bootfile $bootargs The sequence to disable autoboot varies, depending upon the customized autoboot code, but with the standard auto- boot sequence it is as follows: When the title screen starts to fade in, press and hold the Esc (escape) key. Properly timed, this stops the standard kernel boot, and the system instead displays a screen asking whether to go into maintenance mode. From this screen, press control-D to disable autoboot. Control-E may be pressed to re-enable autoboot. In this manner, it is possible to test autoboot first with the A command, then press Esc and control-E to enable autoboot, ensuring that it will be possible to reach the screen to turn it off again later. Autoboot can also be cleared by using an EEPROM programmer to rewrite the boot monitor to the flash. From the sboot prompt, autoboot can be turned off with the command: P 0 It should be noted, however, that the sboot prompt cannot be easily reached once the machine is restarted with auto- boot enabled. In particular, the serial debugger connec- tion is no longer active. EXAMPLES All these examples are run from the sboot console: Page 6 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) To see the current partition table: P Before creating a default partition table, existing infor- mation first must be cleared. This can be done by copying from the zero device to the partition table: c Z!200 F!partition Create a new partition table with some sample partitions (assuming a 4MB flash): P 0 0 8000 644 0 demon P 1 8000 18000 644 0 sboot P 2 20000 80000 666 0 kern P 3 a0000 80000 666 0 kern2 P 4 120000 280000 666 0 fs Boot a kernel that resides in the host filesystem (where armsd is running): b D!infernosword Boot a compressed kernel: b D!infernosword.gz Download a new kernel into flash, after first compressing the kernel with gzip: c D!infernosword.gz F!kern Download a compressed file system to the board, uncompress it, and save it to a flash partition called `fs': c/u D!swordfs.gz F!fs Boot the kernel from flash: b F!kern To boot a kernel that needs to use the serial line for some other purpose (such as a PPP link), and to be able to switch the line while the kernel is uncompressing, it is necessary to redirect the output to the screen first, instead of the default debugger console. This can be accomplished with: > v b F!kern Page 7 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) Examine memory, for instance 200 bytes at offset 4000: e @4000,200 Alternatively, this format could be used to quickly examine a single 32-bit word: E 4000 Deposit three values in memory, for instance the values 1, 2, and 3 at offset 0xa94 (in 32-bit words): d @a94 1 2 3 Alternatively, to change a single value, this format could be used: D a94 1 Enter new lines directly into the plan9.ini partition, first zero it out to be safe: c Z!1000 F!plan9.ini Copy from standard input to the partition `plan9.ini': c - F!plan9.ini After entering the new lines, end the input with control-D. When typing directly on the device, this only has to be typed once. From `armsd', control-D needs to be typed twice, and when using `armsd' from DOS/Windows, further followed by a carriage return. Change the `bootfile' variable to `F!kern2': bootfile=F!kern2 Change the default radix to 10 (it defaults to 16): r=10 SOURCE /os/boot/net /os/boot/port /os/boot/styxmon /os/boot/sa1100 FILES swordmon sboot Page 8 Plan 9 (printed 12/22/24) SBOOT(10.8) (Strongarm) SBOOT(10.8) SEE ALSO mdb(1), inferno.ini(10.8) styxmon(10.8) BUGS It is slightly elaborate for a bootstrap. Page 9 Plan 9 (printed 12/22/24)