9
0
Fork 0
Commit Graph

401 Commits

Author SHA1 Message Date
Alexander Kurz c3223f98c0 scripts imx-image: add DCD NOP command support
The DCD NOP command is available for all flash header v2 devices (i.MX28,
50, 53, 6 and 7).

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-07 08:55:15 +01:00
Sascha Hauer 64b164356a Merge branch 'for-next/mvebu' 2016-10-10 08:31:08 +02:00
Uwe Kleine-König 481274a935 scripts: kwboot: set boot source to UART before sending
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>
2016-10-04 21:14:20 +02:00
Uwe Kleine-König 90184dbc36 scripts: kwboot: simplify kwboot_mmap_image
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>
2016-10-04 21:14:19 +02:00
Uwe Kleine-König ebec445092 scripts: kwboot: shorten delay between two boot messages
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>
2016-10-04 21:14:19 +02:00
Uwe Kleine-König 1a64dd3854 scripts: kwboot: improve diagnostic output
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>
2016-10-04 21:14:19 +02:00
Uwe Kleine-König 446ff0216e scripts: kwboot: flush input and output only once
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>
2016-10-04 21:14:19 +02:00
Uwe Kleine-König 331391d686 scripts: kwboot: try to resync on packet boundary after receiving a NAK
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>
2016-10-04 21:13:54 +02:00
Sascha Hauer 5e61dd3fb5 Add comp_copy function for use with CONFIG_IMAGE_COMPRESSION_NONE
The Makefile compression commands all append the size of the
uncompressed image. With CONFIG_IMAGE_COMPRESSION_NONE simply
'shipped' is used which does not append the size. Add and use
a special comp_copy function which adds the size. This helps
us to get the uncompressed image size in the startup code later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-15 09:23:43 +02:00
Sascha Hauer 074a8fdc92 Merge branch 'for-next/socfpga' 2016-09-13 14:56:06 +02:00
Sascha Hauer b2c398f440 Merge branch 'for-next/imx' 2016-09-13 14:56:04 +02:00
Alexander Kurz 2f9ff8a8f7 scripts: imx: add support for i.MX50
Add imximg support for i.MX50 processors which use the i.MX flash
header v2 format.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-12 08:23:09 +02:00
Andrey Smirnov f7a2e37fcd i.MX: scripts: Fix a bug in imx-image
In order to clear a bitmask, "Set" bit has to be '0' and "Mask" bit
'1'. Since "Set" is bit 4 and "Mask" is bit 3 this leaves us with a
overal or-mask of 1 << 3. Orginal code was doing the inverse and setting
bit #4 to '1' bit #3 to '0'.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:43:29 +02:00
Alexander Kurz c973b3adbf scripts: imx-usb-loader: cleanup DCD v2 processing
Re-Implement the DCD v2 processing.
Processing for the DCD write command went into a separate function enabling
the over-all DCD processing to handle check, nop and unlock commands as well.
The trivial NOP command is supported right away.
Further changes: put in some data consistancy checks and error handling, do
structured member access and proper endianess handling and direct error
messages to stderr.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:37:32 +02:00
Alexander Kurz 4bbfe971bb scripts: imx-usb-loader: structured DCD v1 element access
DCD v1 elements are encoded little endian.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-22 08:02:04 +02:00
Alexander Kurz fdb7f089e5 scripts: imx-usb-loader: enable DCD 16-bit write for hdr v1
Do some cleanup which enables DCDv1 16 bit write access as side effect.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-22 08:01:35 +02:00
Alexander Kurz 2af7f2b26b scripts: imx-image: DCD check command for v2 only
DCD check command is currently implemented for imximg v2 only.
This command may also be available for v1 as mentioned in IMX35RM as
DCD-address-type "wait/read", but due to the lack of further details
it will be not supported.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-22 07:59:31 +02:00
Alexander Kurz a6e1dbebd1 scripts: imx-usb-loader: do DCD only once, cleanup
Only the first encountered DCD block should be processed, optional DCD
processing may be switched off by command option.
Clean up the corresponding logic.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-22 07:51:05 +02:00
Trent Piepho 994fa02f5d socfpga: Add support for V1 images to socfpga_mkimage
Altera's SocFPGA Arria10 SoC uses a new image format, different from
the one used on CycloneV.  The formats are similar, with the header
matching up to the point where the version field is 1 instead of 0.
At that point the header fields diverge.  The CRC and checksum use is
the same between the two.

This patch extends socfpga_mkimage to support generating the new
format with a version command line option.  The default will be V0 for
CycloneV.

The new format is, IMHO, not as good as the previous one.  It requires
the start location be after the header, while the V0 format would
allow the start location to be before or after.  Barebox boot images
are designed to start from offset 0, which is before the header.  To
avoid modifying the common barebox start code specifically for
Arria10, I instead add a trampoline instruction after the V1 header to
jump to the real start location, wherever it might be.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 08:22:16 +02:00
Steffen Trumtrar eabab33283 scripts: socfpga_get_sequencer: convert potential CRLF to LF
If u-boot was generated under a DOS system, the sequencer files will have CRLF
linebreaks. The indent-tool has problems with this and as a result the code
will not compile anymore.
Fix up any CRLFs prior with the dos2unix tool.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-18 08:18:32 +02:00
Alexander Kurz f5d5c63010 scripts: imx-usb-loader: split off topic-code into functions
Improve code understandability: extract the "jump application" Serial
Download Protocol access method and file-to-buffer reader functionality
out of do_irom_download().

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 08:02:20 +02:00
Alexander Kurz 10e712c967 scripts: imx-usb-loader: structured protocol access
Do some cleanup and access the elements of Serial Download Protocol
messages in endianess-portable manner using proper typed struct members.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 07:57:45 +02:00
Alexander Kurz 4145dfc277 scripts: imx-usb-loader: remove useless variable
Remove a variable raising complexity for no reason.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 07:55:17 +02:00
Alexander Kurz e0916fe82f scripts: imx-usb-loader: remove useless code
The configuration interface for struct usb_work is not implemented here
leaving the options set on fixed settings or even uninitialized.
Do some cleanup and remove those half-cooked dead code passages.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 07:53:33 +02:00
Alexander Kurz 9e53ae2c38 scripts: imx-usb-loader: const function args
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 07:48:44 +02:00
Alexander Kurz 6a53edd9a3 scripts: imx: const function arguments
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-18 07:48:28 +02:00
Sascha Hauer f64075972b Merge branch 'for-next/misc' 2016-07-11 07:58:33 +02:00
张忠山 257abdaa36 Do not rm the path from pbl-y target
Whan add some obj in a subdir to lwl-y or pbl-y, like this:

     lwl-y += subdir/test.o other.o

the make process failed:

     make[2]: *** No rule to make target
'arch/arm/boards/boardname/test.o', \
         needed by 'arch/arm/boards/boardname/built-in-pbl.o'.  Stop.

Note, there are not the part "subdir" in the path of the test.o.

this patch fix this

Signed-off-by: 张忠山 <zzs213@126.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-05 09:02:41 +02:00
Alexander Shiyan 341aca3762 Add more files to .gitignore
This patch adds more generated files to ignore list.
...
shc@shc /home/git/barebox-github $ git status
На ветке imx51
Неотслеживаемые файлы:
  (используйте «git add <файл>…», чтобы добавить в то, что будет включено в коммит)

        common/barebox_default_env
        common/barebox_default_env.h
        include/asm
        scripts/basic/docproc

ничего не добавлено в коммит, но есть неотслеживаемые файлы (используйте "git add", чтобы отслеживать их)

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-05 09:02:40 +02:00
Alexander Kurz 7e97af8858 ARM: i.MX: central SOC type definition
Move the definition of iMX CPU types to an individual file to allow
on-purpose inclusion. Eliminate magic number CPU type encoding in the
scripts/imx subdir using the new include file.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-04 09:30:56 +02:00
Alexander Kurz c8608f0772 scripts: imx-image: super_root_key command depends on header_version 1
The Super Root Key pointer exclusively exists in flash header version 1
which is used for i.MX25, i.MX35 and i.MX51 SOC as described in freescales
AN4547 document. Simplify the code a little bit.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-04 09:30:56 +02:00
Trent Piepho 4763fac31c socfpga: correct start vector when not using extra barebox header
The barebox ARM image has a 0x50 byte header that consists of:
Bytes 0x00 - 0x0a:  Instruction(s) to jump to start of code
Bytes 0x20 - 0x2f:  Signature and some other data
The rest of header is basically padding.

On SocFPGA, the ROM bootloader expects the 2nd stage bootloader
(barebox) to have a 0x40 byte header with the following fields:
Bytes 0x40 - 0x4b:  Signature and some other data
Bytes 0x4c - 0x4f:  Instruction to jump to start of code

These two headers are compatible, as everything defined in the SocFPGA
header is at a location that is padding the barebox header.

socfpga_mkimage has two methods for creating a SocFPGA image.  One method
prepends an extra 512 byte header to the barebox image, which contains the
SoCFPGA header described above.  The start vector at 0x4c is hard coded to
jump to offset 512, where the barebox header's start vector will be.

socfpga_mkimage can also not prepend this additional header and instead
modify the barebox header to be SoCFPGA compatible.  But it only writes
bytes 0x40-0x4b and not the start vector at 0x4c, leaving that word as
padding.  And so this image will not boot when the ROM bootloader runs it.

This changes the SoCFPGA header creator to write a correct start vector for
both methods.  It will create a branch instruction at 0x4c that jumps to the
start of the barebox image, whether it be at offset 0 or offset 512 (or any
other location).

This makes SoCFPGA images without the extra header bootable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-23 09:48:46 +02:00
Sascha Hauer 4cb8e17aa3 Merge branch 'for-next/misc' 2016-05-09 08:49:43 +02:00
Sascha Hauer 55aca0a48c Merge branch 'for-next/include-cleanup' 2016-05-09 08:49:42 +02:00
Sascha Hauer 21981dbe6c Merge branch 'for-next/imx' 2016-05-09 08:49:42 +02:00
Sascha Hauer 52da32ec4d scripts: Add big endian conversion macros to endian.h
Some programs need the big endian macros, add them to andian.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:43:14 +02:00
Sascha Hauer 854ba3f912 scripts: imx-usb-loader: support set_bits/clear_bits
Now that we can use set_bits/clear_bits in the DCD tables, add support
for this in the imx-usb-loader aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:08:38 +02:00
Sascha Hauer 471893d020 scripts: imx-usb-loader: make debug output more useful
- print write_memory message only in verbose mode, but in all
  cases when memory is written
- print more information about the DCD section just executed

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:08:34 +02:00
Sascha Hauer f1d34c2738 scripts: imx: support set_bits/clear_bits
The i.MX SoCs support setting bits and clearing bits in their DCD table.
This adds commands for these in the imx-image tool.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:08:28 +02:00
Sascha Hauer 473d6f8a7a stdio: replace fprintf(stderr,...) with eprintf
We have a shortcut for fprintf(stderr, so use it. This is done to
be able to remove fprintf in the next step.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:46 +02:00
Alexander Stein 78118046b5 scripts: imx-image: Fix image size in flash header for i.MX35
The i.MX35 needs additional 0x1000 byte. This quirk moved to the wrong
location during refactoring of imx-image for v2016.03.0.

Fixes: adade59759 ""scripts: imx: Allow to create signed images")
Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-14 07:58:17 +02:00
Sascha Hauer ca275c3ef1 Merge branch 'for-next/imd' 2016-04-08 13:37:28 +02:00
Sascha Hauer d3b805ad9a scripts: imx: imx-image: Fix image size for HABv3 images
When the image contains CSF data we must add CSF_LEN to the image
size pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-06 10:19:00 +02:00
Sascha Hauer 439d683051 imd: rename imd_search_validate to imd_get
The name is more suitable for what the function does. Also let the
function return a pointer to the imd data found in the buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-01 10:38:55 +02:00
Sascha Hauer 82d40a6214 scripts: Add scripts/include/ to include path for target programs
Programs compiled for the target need -I $(srctree)/scripts/include/ to
be able to include for example linux/err.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-01 10:38:54 +02:00
Sascha Hauer f1a2d54cba scripts: make __init__.py nonempty
Otherwise they get removed by make distclean.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-12 08:44:30 +01:00
Sascha Hauer c073534880 Merge branch 'for-next/ratp' 2016-02-08 08:27:01 +01:00
Sascha Hauer 6435fb09d8 Merge branch 'for-next/hab' 2016-02-08 08:26:35 +01:00
Sascha Hauer 610cc35c1e scripts: imx-usb-loader: Do not zero out boot_data_ptr
This shouldn't be necessary. So far it didn't hurt either, but now
this invalidates the signature of the image, so keep the image
unmodified.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-04 14:38:33 +01:00
Sascha Hauer 796694c0b2 Make: i.MX: Allow to pass config file to cmd_imx_image
Pass the config file to cmd_imx_image as arguments to make it more
flexible. Also add the possibility for another arg containing additional
options.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-02-04 14:38:29 +01:00