blob: 32d324f055011fea978ba1b4a179f4531283ef1f [file] [log] [blame]
Pali Rohár9eaf2b72022-03-02 11:49:25 +01001.TH KWBOOT 1 "2022-03-02"
Luka Perkovdff289642012-05-27 11:44:51 +00002
3.SH NAME
Marek Behúna7605d12021-09-24 23:07:15 +02004kwboot \- Boot Marvell Kirkwood (and others 32-bit) SoCs over a serial link.
Luka Perkovdff289642012-05-27 11:44:51 +00005.SH SYNOPSIS
6.B kwboot
7.RB [ "-b \fIimage\fP" ]
Luka Perkovdff289642012-05-27 11:44:51 +00008.RB [ "-t" ]
9.RB [ "-B \fIbaudrate\fP" ]
10.RB \fITTY\fP
11.SH "DESCRIPTION"
12
Marek Behúna7605d12021-09-24 23:07:15 +020013The \fBkwboot\fP program boots boards based on Marvell's 32-bit
Pali Rohárf4e9e872022-03-02 11:49:26 +010014platforms including Kirkwood, Dove, Avanta, A370, AXP, A375, A38x
Marek Behúna7605d12021-09-24 23:07:15 +020015and A39x over their integrated UART. Boot image files will typically
Luka Perkovdff289642012-05-27 11:44:51 +000016contain a second stage boot loader, such as U-Boot. The image file
17must conform to Marvell's BootROM firmware image format
Marek Behúna7605d12021-09-24 23:07:15 +020018(\fIkwbimage v0\fP or \fIv1\fP), created using a tool such as
19\fBmkimage\fP.
Luka Perkovdff289642012-05-27 11:44:51 +000020
21Following power-up or a system reset, system BootROM code polls the
22UART for a brief period of time, sensing a handshake message which
23initiates an image upload. This program sends this boot message until
Vagrant Cascadian53d41e62016-03-15 12:16:39 -070024it receives a positive acknowledgement. The image is transferred using
Luka Perkovdff289642012-05-27 11:44:51 +000025Xmodem.
26
27Additionally, this program implements a minimal terminal mode, which
28can be used either standalone, or entered immediately following boot
29image transfer completion. This is often useful to catch early boot
30messages, or to manually interrupt a default boot procedure performed
31by the second-stage loader.
32
33.SH "OPTIONS"
34
35.TP
36.BI "\-b \fIimage\fP"
37Handshake; then upload file \fIimage\fP over \fITTY\fP.
38
39Note that for the encapsulated boot code to be executed, \fIimage\fP
Marek Behúna7605d12021-09-24 23:07:15 +020040must be of type "UART boot" (0x69). The \fBkwboot\fP program changes
41this type automatically, unless the \fIimage\fP is signed, in which
42case it cannot be changed.
Luka Perkovdff289642012-05-27 11:44:51 +000043
44This mode writes handshake status and upload progress indication to
Marek Behúna7605d12021-09-24 23:07:15 +020045stdout. It is possible that \fIimage\fP contains an optional binary
46code in it's header which may also print some output via UART (for
47example U-Boot SPL does this). In such a case, this output is also
48written to stdout after the header is sent.
Luka Perkovdff289642012-05-27 11:44:51 +000049
50.TP
Pali Rohár9eaf2b72022-03-02 11:49:25 +010051.B "\-b"
52Do only handshake on \fITTY\fP without uploading any file. File upload
53could be done later via option \fB\-D\fP or via any other Xmodem
54application, like \fBsx\fP(1).
55
56.TP
57.B "\-d"
58Do special handshake on \fITTY\fP for console debug mode.
59
60This will instruct BootROM to enter builtin simple console debug mode.
61Should be combined with option \fB\-t\fP.
62
63To get a BootROM help, type this command followed by ENTER key:
64
65.RS 1.2i
66.TP
67.B ?
68.RE
69.IP
70
71Armada 38x BootROM has a bug which cause that BootROM's standard output
Pali Rohár6509e922023-03-11 11:42:16 +010072is turned off on UART when default boot source location contains valid boot image. Nevertheless
Pali Rohár9eaf2b72022-03-02 11:49:25 +010073BootROM's standard input and BootROM's terminal echo are active and working
74fine. To workaround this BootROM bug with standard output, it is possible
75to manually overwrite BootROM variables stored in SRAM which BootROM use
76for checking if standard output is enabled or not. To enable BootROM
Vagrant Cascadian45131422022-04-19 17:48:27 -070077standard output on UART, type this command followed by ENTER key:
Pali Rohár9eaf2b72022-03-02 11:49:25 +010078
79.RS 1.2i
80.TP
81.B w 0x40034100 1
82.RE
83
84.TP
85.BI "\-D" " image"
86Upload file \fIimage\fP over \fITTY\fP without initial handshake.
87
88This method is used primary on Dove platforms, where BootROM does
89not support initial handshake for entering UART upload mode and
90strapping pins (exported via e.g. buttons) are used instead.
91
92.TP
Luka Perkovdff289642012-05-27 11:44:51 +000093.BI "\-p"
Marek Behúna7605d12021-09-24 23:07:15 +020094Obsolete. Does nothing.
Luka Perkovdff289642012-05-27 11:44:51 +000095
Marek Behúna7605d12021-09-24 23:07:15 +020096In the past, when this option was used, the program patched the header
97in the image prior upload, to "UART boot" type. This is now done by
98default.
Luka Perkovdff289642012-05-27 11:44:51 +000099
100.TP
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100101.B "\-q"
102Obsolete. Does nothing.
103
104It is unknown whether it did something in the past.
105
106.TP
107.BI "\-s" " response-timeout"
108Specify custom response timeout when doing handshake. Default value is 50 ms.
109It is the timeout between sending two consecutive handshake patterns, meaning
110how long to wait for response from BootROM. Affects only option \fB\-b\fP with
111image file and option \fB\-d\fP.
112
113Option \fB-a\fP specify response timeout suitable for Armada XP BootROM and
114currently it is 1000 ms.
115
116Some testing showed that specifying 24 ms as response timeout make handshake
117with Armada 385 BootROM more stable.
118
119.TP
Luka Perkovdff289642012-05-27 11:44:51 +0000120.BI "\-t"
121Run a terminal program, connecting standard input and output to
122.RB \fITTY\fP.
123
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100124If used in combination with \fB\-b\fP, \fB\-D\fP or \fB\-d\fP option,
125terminal mode is entered immediately following a successful image upload
126or successful handshake (if not doing image upload).
Luka Perkovdff289642012-05-27 11:44:51 +0000127
128If standard I/O streams connect to a console, this mode will terminate
Marek Behúna7605d12021-09-24 23:07:15 +0200129after receiving \fBctrl-\e\fP followed by \fBc\fP from console input.
Luka Perkovdff289642012-05-27 11:44:51 +0000130
131.TP
132.BI "\-B \fIbaudrate\fP"
Marek Behúna7605d12021-09-24 23:07:15 +0200133If used in combination with \fB-b\fP, inject into the image header
134code that changes baud rate to \fIbaudrate\fP after uploading image
135header, and code that changes the baud rate back to the default
136(115200 Bd) before executing payload, and also adjust the baud rate
137on \fITTY\fP correspondingly. This can make the upload significantly
138faster.
139
140If used in combination with \fB-t\fP, adjust the baud rate to
141\fIbaudrate\fP on \fITTY\fP before starting terminal.
142
143If both \fB-b\fP and \fB-t\fP are used, the baud rate is changed
144back to 115200 after the upload.
145
146Tested values for \fIbaudrate\fP for Armada 38x include: 115200,
147230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000,
1482000000, 2500000, 3125000, 4000000 and 5200000.
Luka Perkovdff289642012-05-27 11:44:51 +0000149
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100150.SH "EXAMPLES"
151
Pali Rohárdf71c312022-11-02 18:51:28 +0100152Instruct BootROM to enter boot Xmodem boot mode, send \fIu-boot-with-spl.kwb\fP
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100153kwbimage file via Xmodem on \fI/dev/ttyUSB0\fP at 115200 Bd and run terminal
154program:
155.IP
Pali Rohárdf71c312022-11-02 18:51:28 +0100156.B kwboot -b u-boot-with-spl.kwb -t /dev/ttyUSB0
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100157
158.PP
159Instruct BootROM to enter boot Xmodem boot mode, send header of
Pali Rohárdf71c312022-11-02 18:51:28 +0100160\fIu-boot-with-spl.kwb\fP kwbimage file via Xmodem at 115200 Bd, then instruct
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100161BootROM to change baudrate to 5200000 Bd, send data part of the kwbimage
Pali Rohár1e38edd2023-01-26 22:37:26 +0100162file via Xmodem at high speed, then change baudrate back to 115200 Bd,
163and finally run terminal program:
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100164.IP
Pali Rohárdf71c312022-11-02 18:51:28 +0100165.B kwboot -b u-boot-with-spl.kwb -B 5200000 -t /dev/ttyUSB0
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100166
167.PP
Pali Rohárdf71c312022-11-02 18:51:28 +0100168Only send \fIu-boot-with-spl.kwb\fP kwbimage file via Xmodem on \fI/dev/ttyUSB0\fP
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100169at 115200 Bd:
170.IP
Pali Rohárdf71c312022-11-02 18:51:28 +0100171.B kwboot -D u-boot-with-spl.kwb /dev/ttyUSB0
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100172
173.PP
174Instruct BootROM to enter console debug mode and run terminal program on
175\fI/dev/ttyUSB0\fP at 115200 Bd:
176.IP
177.B kwboot -d -t /dev/ttyUSB0
178
179.PP
180Only run terminal program on \fI/dev/ttyUSB0\fP at 115200 Bd:
181.IP
182.B kwboot -t /dev/ttyUSB0
183
Luka Perkovdff289642012-05-27 11:44:51 +0000184.SH "SEE ALSO"
185.PP
Pali Rohár9eaf2b72022-03-02 11:49:25 +0100186\fBmkimage\fP(1), \fBsx\fP(1)
Luka Perkovdff289642012-05-27 11:44:51 +0000187
188.SH "AUTHORS"
189
190Daniel Stodden <daniel.stodden@gmail.com>
191.br
Luka Perkove91505d2012-12-03 03:24:15 +0000192Luka Perkov <luka@openwrt.org>
Luka Perkovdff289642012-05-27 11:44:51 +0000193.br
194David Purdy <david.c.purdy@gmail.com>
Marek Behúna7605d12021-09-24 23:07:15 +0200195.br
196Pali Rohár <pali@kernel.org>
197.br
Marek Behúnd63726e2022-06-01 17:17:06 +0200198Marek Behún <kabel@kernel.org>