summaryrefslogtreecommitdiffstats
path: root/scripts/kwboot.c
Commit message (Collapse)AuthorAgeFilesLines
* scripts/kwboot: fix image check for v0 imagesUwe Kleine-König2018-06-081-10/+53
| | | | | | | | | Since kwboot checks the contents of the file to send it only works for v1 images (or with -f). Extend the check to know about v0 images, too. Fixes: 39ebd7e73bec ("kwboot: do a filetype check before sending the image") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts/kwboot: document -n optionUwe Kleine-König2017-06-301-1/+3
| | | | | | | This was forgotten in the commit that added support for that option Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts/kwboot: new parameter -n to skip a number of NAKsUwe Kleine-König2017-02-141-5/+13
| | | | | | | | | | | | | | On some machines the CPU resets twice and so kwboot must hit the second window to enter debug or boot mode. For this scenario it helps to ignore a number of NAKs. If you choose a number too high for booting, the process is only slowed down because when the CPU enters UART boot mode it sends NAKs when not getting any input. This new option also helps when there are voltage fluctuations due to the power up sequence which might be interpreted as valid chars. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: fix image check for padded imagesUwe Kleine-König2017-02-141-4/+12
| | | | | | | | | | | | | | When there is some padding between header and payload the claim header_size + image_size == file_size fails. Relax the check accordingly to: header_size <= image_offset && image_offset + image_size == file_size Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: set boot source to UART before sendingUwe Kleine-König2016-10-041-3/+11
| | | | | | | | Sending an image that specifies one of the alternative boot sources doesn't make sense. So change the boot source to UART on the fly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: simplify kwboot_mmap_imageUwe Kleine-König2016-10-041-6/+4
| | | | | | | | There was only a single caller who passes prot=PROT_READ unconditionally. So drop this parameter and simplify accordingly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: shorten delay between two boot messagesUwe Kleine-König2016-10-041-1/+1
| | | | | | | | | Together with the previous changes that allow to handle the scenario where too many messages were sent, this greatly improves the probability to hit the time window during which the CPU accepts a boot message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: improve diagnostic outputUwe Kleine-König2016-10-041-3/+12
| | | | | | | | | After entering uart boot mode the CPU prints some diagnostic messages. Showing them to the user helps her to notice when the message window was missed or there is an other problem. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: flush input and output only onceUwe Kleine-König2016-10-041-8/+8
| | | | | | | | | | | When flushing input before sending of a boot message the acknowledging reply for the previous message from the CPU might be discarded and so missed. So only flush once before sending boot messages in a loop. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: try to resync on packet boundary after receiving a NAKUwe Kleine-König2016-10-041-1/+45
| | | | | | | | | | | | | | | | | | | If we sent the boot message too often the CPU might already have started to interpret this as an xmodem packet. As sender and receiver are not in sync it's impossible to transfer a packet successfully. So when we get a NAK send '\xff' bytes until the receiver reaches the packet boundary. When we send too many the SoC replies with a NAK for each byte and doesn't interpret it as the start of a new package (which must start with SOH == '\x01'). A slower alternative would be to wait for another NAK which is sent when reception of the already started packet times out. This was tested on an Armada XP based machine with bootrom version 1.20. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* kwboot: do a filetype check before sending the imageUwe Kleine-König2016-01-261-2/+70
| | | | | Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: fix detection of timeoutUwe Kleine-König2014-11-171-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In function kwboot_xm_sendblock() the loop that implements retrying to send a boot block might be quit if kwboot_tty_send or kwboot_tty_recv return a failure. In this case the value of the variable c that is expected to hold the response byte is uninitialized and most likely still holds an ACK from the previous call to kwboot_xm_sendblock(). So the right thing to do is not to clobber rc if it's already != 0. The result of this patch in my current scenario is that kwboot dies with xmodem: Connection timed out when the SoC stops replying instead of continuing to try sending the remaining blocks which results in select() blocking for one second for each block. Fixes: 0535713bbfa0 ("scripts: add kwboot tool") Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> -- Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> I also tried to increase the timeout, but without success :-(. Will test a different USB-to-RS232 adapter ... Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts/kwboot: Remove redundant assignmentAlexander Shiyan2014-02-171-1/+0
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: fix missing soh initializationSebastian Hesselbarth2013-11-181-0/+1
| | | | | | | | | Xmodem blocks should start with SOH but kwboot never sets the first block byte. This fixes kwboot's Xmodem block initialization and sets first block byte to SOH. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: kwboot: add support for Marvell DoveSebastian Hesselbarth2013-05-141-9/+22
| | | | | | | | | | | | | | | | Marvell Dove SoC also has an UART bootmode to upload payload after powerup. In contrast to Kirkwood and Armada 370/XP, Dove does not respond to a special sequence sent on UART0 but requires to be booted into UART bootmode by bootstraps. This is usually done by pressing a push button that will set bootstraps accordingly. This patch adds a new option, documentation and corresponding prompts to support the above requirements. Also a left-over option ('-p') is removed. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: add kwboot toolThomas Petazzoni2013-05-111-0/+717
This tool is used with Marvell EBU SoC to trigger the UART boot mode provided by the SoC BootROM, and push the bootloader image to the target using the Xmodem protocol. It has been taken from the U-Boot source code, with minor modifications to make it work with Armada 370/XP platforms. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>