Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/tls-maxphys]: src/external/bsd/elftosb Add elftosb tools to evbarm userl...
details: https://anonhg.NetBSD.org/src/rev/6cf6fd106972
branches: tls-maxphys
changeset: 852955:6cf6fd106972
user: jkunz <jkunz%NetBSD.org@localhost>
date: Thu Nov 15 19:49:13 2012 +0000
description:
Add elftosb tools to evbarm userland and toolchain.
Elftosb is used to create a digitaly signed "secure boot" file.
This sb file can be booted by the first stage boot loader found in
Freescale i.MX23 and i.MX28 application processors.
Copyright (c) 2004-2010 Freescale Semiconductor, Inc.
diffstat:
external/bsd/elftosb/Makefile | 8 +
external/bsd/elftosb/Makefile.inc | 25 +
external/bsd/elftosb/dist/COPYING | 28 +
external/bsd/elftosb/dist/ReadMe.txt | 45 +
external/bsd/elftosb/dist/bdfiles/basic_test_cmd.e | 192 +
external/bsd/elftosb/dist/bdfiles/complex.bd | 260 +
external/bsd/elftosb/dist/bdfiles/habtest.bd | 36 +
external/bsd/elftosb/dist/bdfiles/simple.e | 8 +
external/bsd/elftosb/dist/bdfiles/test_cmd.e | 120 +
external/bsd/elftosb/dist/common/AESKey.cpp | 78 +
external/bsd/elftosb/dist/common/AESKey.h | 144 +
external/bsd/elftosb/dist/common/Blob.cpp | 123 +
external/bsd/elftosb/dist/common/Blob.h | 70 +
external/bsd/elftosb/dist/common/BootImage.h | 54 +
external/bsd/elftosb/dist/common/DataSource.cpp | 224 +
external/bsd/elftosb/dist/common/DataSource.h | 299 +
external/bsd/elftosb/dist/common/DataSourceImager.cpp | 143 +
external/bsd/elftosb/dist/common/DataSourceImager.h | 54 +
external/bsd/elftosb/dist/common/DataTarget.cpp | 59 +
external/bsd/elftosb/dist/common/DataTarget.h | 122 +
external/bsd/elftosb/dist/common/ELF.h | 332 +
external/bsd/elftosb/dist/common/ELFSourceFile.cpp | 529 +
external/bsd/elftosb/dist/common/ELFSourceFile.h | 224 +
external/bsd/elftosb/dist/common/EncoreBootImage.cpp | 1372 +
external/bsd/elftosb/dist/common/EncoreBootImage.h | 967 +
external/bsd/elftosb/dist/common/EndianUtilities.h | 141 +
external/bsd/elftosb/dist/common/EvalContext.cpp | 111 +
external/bsd/elftosb/dist/common/EvalContext.h | 99 +
external/bsd/elftosb/dist/common/ExcludesListMatcher.cpp | 88 +
external/bsd/elftosb/dist/common/ExcludesListMatcher.h | 67 +
external/bsd/elftosb/dist/common/GHSSecInfo.cpp | 100 +
external/bsd/elftosb/dist/common/GHSSecInfo.h | 72 +
external/bsd/elftosb/dist/common/GlobMatcher.cpp | 129 +
external/bsd/elftosb/dist/common/GlobMatcher.h | 59 +
external/bsd/elftosb/dist/common/HexValues.cpp | 34 +
external/bsd/elftosb/dist/common/HexValues.h | 21 +
external/bsd/elftosb/dist/common/IVTDataSource.cpp | 113 +
external/bsd/elftosb/dist/common/IVTDataSource.h | 296 +
external/bsd/elftosb/dist/common/Logging.cpp | 91 +
external/bsd/elftosb/dist/common/Logging.h | 226 +
external/bsd/elftosb/dist/common/Operation.cpp | 63 +
external/bsd/elftosb/dist/common/Operation.h | 168 +
external/bsd/elftosb/dist/common/OptionContext.h | 50 +
external/bsd/elftosb/dist/common/OptionDictionary.cpp | 170 +
external/bsd/elftosb/dist/common/OptionDictionary.h | 107 +
external/bsd/elftosb/dist/common/OutputSection.cpp | 9 +
external/bsd/elftosb/dist/common/OutputSection.h | 72 +
external/bsd/elftosb/dist/common/Random.cpp | 85 +
external/bsd/elftosb/dist/common/Random.h | 57 +
external/bsd/elftosb/dist/common/RijndaelCBCMAC.cpp | 86 +
external/bsd/elftosb/dist/common/RijndaelCBCMAC.h | 62 +
external/bsd/elftosb/dist/common/SHA1.cpp | 274 +
external/bsd/elftosb/dist/common/SHA1.h | 149 +
external/bsd/elftosb/dist/common/SRecordSourceFile.cpp | 176 +
external/bsd/elftosb/dist/common/SRecordSourceFile.h | 83 +
external/bsd/elftosb/dist/common/SearchPath.cpp | 121 +
external/bsd/elftosb/dist/common/SearchPath.h | 58 +
external/bsd/elftosb/dist/common/SourceFile.cpp | 178 +
external/bsd/elftosb/dist/common/SourceFile.h | 156 +
external/bsd/elftosb/dist/common/StELFFile.cpp | 531 +
external/bsd/elftosb/dist/common/StELFFile.h | 196 +
external/bsd/elftosb/dist/common/StExecutableImage.cpp | 463 +
external/bsd/elftosb/dist/common/StExecutableImage.h | 251 +
external/bsd/elftosb/dist/common/StSRecordFile.cpp | 235 +
external/bsd/elftosb/dist/common/StSRecordFile.h | 119 +
external/bsd/elftosb/dist/common/StringMatcher.h | 62 +
external/bsd/elftosb/dist/common/Value.cpp | 43 +
external/bsd/elftosb/dist/common/Value.h | 138 +
external/bsd/elftosb/dist/common/Version.cpp | 143 +
external/bsd/elftosb/dist/common/Version.h | 51 +
external/bsd/elftosb/dist/common/crc.cpp | 292 +
external/bsd/elftosb/dist/common/crc.h | 48 +
external/bsd/elftosb/dist/common/format_string.cpp | 79 +
external/bsd/elftosb/dist/common/format_string.h | 20 +
external/bsd/elftosb/dist/common/int_size.h | 22 +
external/bsd/elftosb/dist/common/options.cpp | 1140 +
external/bsd/elftosb/dist/common/options.h | 488 +
external/bsd/elftosb/dist/common/rijndael.cpp | 1604 +
external/bsd/elftosb/dist/common/rijndael.h | 159 +
external/bsd/elftosb/dist/common/smart_ptr.h | 232 +
external/bsd/elftosb/dist/common/stdafx.cpp | 8 +
external/bsd/elftosb/dist/common/stdafx.h | 83 +
external/bsd/elftosb/dist/elftosb.ccscc | 7 +
external/bsd/elftosb/dist/elftosb.sln | 46 +
external/bsd/elftosb/dist/elftosb.suo | Bin
external/bsd/elftosb/dist/elftosb.xcodeproj/creed.mode1 | 1527 +
external/bsd/elftosb/dist/elftosb.xcodeproj/creed.mode1v3 | 1569 +
external/bsd/elftosb/dist/elftosb.xcodeproj/creed.pbxuser | 4452 +++
external/bsd/elftosb/dist/elftosb.xcodeproj/project.pbxproj | 943 +
external/bsd/elftosb/dist/elftosb2/BootImageGenerator.cpp | 80 +
external/bsd/elftosb/dist/elftosb2/BootImageGenerator.h | 69 +
external/bsd/elftosb/dist/elftosb2/ConversionController.cpp | 1428 +
external/bsd/elftosb/dist/elftosb2/ConversionController.h | 153 +
external/bsd/elftosb/dist/elftosb2/Doxyfile | 250 +
external/bsd/elftosb/dist/elftosb2/ElftosbAST.cpp | 1352 +
external/bsd/elftosb/dist/elftosb2/ElftosbAST.h | 1227 +
external/bsd/elftosb/dist/elftosb2/ElftosbErrors.h | 29 +
external/bsd/elftosb/dist/elftosb2/ElftosbLexer.cpp | 149 +
external/bsd/elftosb/dist/elftosb2/ElftosbLexer.h | 97 +
external/bsd/elftosb/dist/elftosb2/EncoreBootImageGenerator.cpp | 297 +
external/bsd/elftosb/dist/elftosb2/EncoreBootImageGenerator.h | 57 +
external/bsd/elftosb/dist/elftosb2/FlexLexer.h | 208 +
external/bsd/elftosb/dist/elftosb2/elftosb.cpp | 700 +
external/bsd/elftosb/dist/elftosb2/elftosb2.vcproj | 585 +
external/bsd/elftosb/dist/elftosb2/elftosb_lexer.cpp | 2241 +
external/bsd/elftosb/dist/elftosb2/elftosb_lexer.l | 299 +
external/bsd/elftosb/dist/elftosb2/elftosb_parser.tab.cpp | 2955 ++
external/bsd/elftosb/dist/elftosb2/elftosb_parser.tab.hpp | 152 +
external/bsd/elftosb/dist/elftosb2/elftosb_parser.y | 978 +
external/bsd/elftosb/dist/encryptgpk/encryptgpk.cpp | 442 +
external/bsd/elftosb/dist/encryptgpk/encryptgpk.vcproj | 349 +
external/bsd/elftosb/dist/keygen/Doxyfile | 250 +
external/bsd/elftosb/dist/keygen/keygen.cpp | 346 +
external/bsd/elftosb/dist/keygen/keygen.vcproj | 478 +
external/bsd/elftosb/dist/makefile | 32 +
external/bsd/elftosb/dist/makefile.rules | 178 +
external/bsd/elftosb/dist/sbtool/Doxyfile | 250 +
external/bsd/elftosb/dist/sbtool/EncoreBootImageReader.cpp | 370 +
external/bsd/elftosb/dist/sbtool/EncoreBootImageReader.h | 117 +
external/bsd/elftosb/dist/sbtool/sbtool.cpp | 626 +
external/bsd/elftosb/dist/sbtool/sbtool.vcproj | 495 +
external/bsd/elftosb/dist/stdafx.h | 66 +
external/bsd/elftosb/dist/test_elftosb.bat | 12 +
external/bsd/elftosb/dist/test_elftosb.sh | 26 +
external/bsd/elftosb/dist/test_files/ProfileSeed.bin | Bin
external/bsd/elftosb/dist/test_files/ProfileSeedFile50k.bin | Bin
external/bsd/elftosb/dist/test_files/hello_NOR_arm | Bin
external/bsd/elftosb/dist/test_files/hello_NOR_arm.map | 38 +
external/bsd/elftosb/dist/test_files/hello_NOR_mixed | Bin
external/bsd/elftosb/dist/test_files/hello_NOR_mixed.map | 39 +
external/bsd/elftosb/dist/test_files/hello_NOR_thumb | Bin
external/bsd/elftosb/dist/test_files/hello_NOR_thumb.map | 38 +
external/bsd/elftosb/dist/test_files/hostlink | Bin
external/bsd/elftosb/dist/test_files/player_linfix.elf | Bin
external/bsd/elftosb/dist/test_files/plugin_complex | Bin
external/bsd/elftosb/dist/test_files/plugin_hello | Bin
external/bsd/elftosb/dist/test_files/redboot_gcc.srec | 3397 +++
external/bsd/elftosb/dist/test_files/rom_nand_ldr_profile | Bin
external/bsd/elftosb/dist/test_files/sd_player_gcc | Bin
external/bsd/elftosb/dist/test_files/sd_player_gcc.srec | 11250 ++++++++++
external/bsd/elftosb/dist/test_files/test0.key | 1 +
external/bsd/elftosb/usr.sbin/Makefile | 6 +
external/bsd/elftosb/usr.sbin/Makefile.inc | 4 +
external/bsd/elftosb/usr.sbin/elftosb/Makefile | 29 +
external/bsd/elftosb/usr.sbin/elftosb/elftosb.8 | 71 +
external/bsd/elftosb/usr.sbin/sbkeygen/Makefile | 16 +
external/bsd/elftosb/usr.sbin/sbkeygen/sbkeygen.8 | 70 +
external/bsd/elftosb/usr.sbin/sbtool/Makefile | 16 +
external/bsd/elftosb/usr.sbin/sbtool/sbtool.8 | 62 +
149 files changed, 56618 insertions(+), 0 deletions(-)
diffs (truncated from 57190 to 300 lines):
diff -r cf0c56e2c381 -r 6cf6fd106972 external/bsd/elftosb/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/elftosb/Makefile Thu Nov 15 19:49:13 2012 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1.2.2 2012/11/15 19:49:13 jkunz Exp $
+
+.include <bsd.own.mk>
+
+SUBDIR= lib .WAIT usr.sbin
+
+.include <bsd.subdir.mk>
+
diff -r cf0c56e2c381 -r 6cf6fd106972 external/bsd/elftosb/Makefile.inc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/elftosb/Makefile.inc Thu Nov 15 19:49:13 2012 +0000
@@ -0,0 +1,25 @@
+# $NetBSD: Makefile.inc,v 1.1.2.2 2012/11/15 19:49:13 jkunz Exp $
+
+.include <bsd.own.mk>
+
+DIST= ${NETBSDSRCDIR}/external/bsd/elftosb/dist
+
+.PATH: ${DIST}/common
+
+LIBELFTOSBOBJDIR!= cd ${DIST}/../lib && ${PRINTOBJDIR}
+
+.ifndef HOSTPROG
+DPADD+= ${LIBELFTOSBOBJDIR}/libelftosb.a
+LDADD+= -L${LIBELFTOSBOBJDIR} -lelftosb
+.endif
+
+CPPFLAGS+= -I${DIST}/common
+CPPFLAGS+= -I${DIST}/elftosb2
+CPPFLAGS+= -DLinux
+
+CWARNFLAGS+= -Wno-multichar
+
+LIBISCXX= yes
+
+BINDIR= /usr/sbin
+
diff -r cf0c56e2c381 -r 6cf6fd106972 external/bsd/elftosb/dist/COPYING
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/elftosb/dist/COPYING Thu Nov 15 19:49:13 2012 +0000
@@ -0,0 +1,28 @@
+Copyright (c) 2004-2010 Freescale Semiconductor, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+* Neither the name of the Freescale Semiconductor, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff -r cf0c56e2c381 -r 6cf6fd106972 external/bsd/elftosb/dist/ReadMe.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/elftosb/dist/ReadMe.txt Thu Nov 15 19:49:13 2012 +0000
@@ -0,0 +1,45 @@
+elftosb 2.x read me
+-------------------
+
+Directories
+
+elftosb2 - elftosb 2.x
+sbtool - sbtool 1.x
+keygen - keygen 1.x
+common - source files common between elftosb2, sbtool, and keygen
+winsupport - files needed only by the windows build
+elftosb - old elftosb 1.x, does not use anything from common
+generatekeys - old key generation tool for elftosb 1.x
+decrypt - old decryption tool for elftosb 1.x
+unittests - old unit tests for elftosb 1.x
+test_files - test ELF and Srecord files
+old - contains old makefiles for elftosb 1.x
+
+Development
+
+The preferred way to work on elftosb and related tools is to use Xcode on Mac OS X. The
+elftosb.xcodeproj directory is an Xcode project "file". It has targets for elftosb,
+keygen, sbtool, and an aggregate target that builds all of the above. The main reason
+to use Xcode is that the project is set up so that the flex and bison input files are
+processed automatically and the output files compiled.
+
+The Windows project and Linux makefile are not configured to build the flex or bison
+source files. They simply use the output files copied into the elftosb2 directory.
+You can run flex or bison manually to generate these files if you don't want to use Xcode.
+If you do use the Xcode project and make changes to the .l or .y files, be sure to copy
+the output .cpp files into the elftosb2 directory before you move the changes to either
+Windows or Linux.
+
+Building
+
+On Windows, open the .sln file in Microsoft Visual Studio. The solution contains projects
+for each of the individual projects, including the old elftosb 1.x and related tools.
+
+For Linux, run 'make all' from within the top level elftosb directory. This will build only
+the new elftosb 2.x, sbtool, and keygen. The old makefile to build elftosb 1.x and its
+tools is located in the "old" directory.
+
+On Mac OS X just open the .xcodeproj project and build the "Everything" target.
+
+
+
diff -r cf0c56e2c381 -r 6cf6fd106972 external/bsd/elftosb/dist/bdfiles/basic_test_cmd.e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/elftosb/dist/bdfiles/basic_test_cmd.e Thu Nov 15 19:49:13 2012 +0000
@@ -0,0 +1,192 @@
+
+# ooh! test input command file for elftosb 2!
+
+options {
+ coalesce = yes;
+
+ # most elf files are GHS produced
+ toolset = "GHS";
+
+ # set versions
+ productVersion = "111.222.333";
+ componentVersion = "999.888.777";
+
+ # set file flags
+ flags = (1 << 0) | (1 << 1);
+}
+
+constants {
+ ocram_start = 0;
+ ocram_size = 256K;
+ ocram_end = ocram_start + ocram_size - 1;
+
+# ocram = ocram_start .. ocram_end;
+#
+# ocram = ocram_start +.. ocram_size;
+
+ string_addr = 0x4500;
+
+ # boot modes
+ USB_BM = 0;
+ JTAG_BM = 7;
+ newBootMode = USB_BM;
+}
+
+sources {
+ hello = extern(0); # elf
+ redboot = extern(1); # srec
+ hostlink = extern(2); # elf
+ sd_player = extern(3) ( toolset="GCC" ); # elf
+ datasrc = "test0.key"; # binary
+}
+
+section (0) {
+ # load dcd
+ load dcd {{ 00 11 22 33 }} > 0;
+
+ # same load without dcd
+ load {{ 00 11 22 33 }} > 0;
+
+ call 0xf000;
+
+ hab call 0xf0000000 (128);
+ hab jump 0;
+
+/*
+ # load a simple IVT to an absolute address
+ # this fills in the IVT self address field from the target address
+ load ivt (entry=hello:_start) > 0x1000;
+
+ # load simple IVT. the IVT self address is set explicitly in the IVT declaration,
+ # giving the IVT a natural address so you don't have to tell where to load it.
+ load ivt (entry=hello:_start, self=0x1000);
+
+ load ivt (entry=hello:_start, self=0x1000, csf=0x2000, dcd=0);
+
+ # Setting IVT entry point to the default entry point of a source file.
+ load ivt (entry=hostlink) > 0;
+
+ load ivt (entry=hello:_start, self=0x1000);
+ hab call 0x1000;
+
+ # Special syntax that combines the load and call into one statement.
+ hab call ivt(entry=hello:_start, self=0x1000);
+
+
+
+ load ivt (
+ entry = hello:_start,
+ csf = 0x2000
+ ) > 0x1000;
+
+ # All supported IVT fields.
+ load ivt (
+ entry = hello:,
+ dcd = 0,
+ boot_data = 0,
+ self = 0,
+ csf = 0
+ );
+
+ hab call ivt; # Call the last loaded IVT. */
+}
+
+section (32) {
+ # load a string to some address
+ load "some string" > string_addr;
+
+ # byte fill a region
+ load 0x55.b > ocram_start..ocram_end;
+
+ from hostlink {
+ load $*;
+ }
+
+ # jump to a symbol
+ jump hostlink:_start (100);
+}
+
+section (100)
+{
+ load redboot;
+ call redboot;
+}
+
+section(0x5a)
+{
+ load datasrc > 0..8;
+
+ from hostlink
+ {
+# load $* ( $.ocram.*, ~$.sdram.* );
+
+# load $.sdram.*;
+# load $.ocram.*;
+
+ call :main;
+ call :_start;
+ }
+
+# goto 0x5b;
+}
+
+section (0x5b)
+{
+# load $* from sd_player;
+
+# load hello$.text @ 64K;
+# load hello$*
+
+ load $.text from hello > 0x10000;
+ call sd_player (0xdeadbeef);
+}
+
+section (0x5c)
+{
+ # these loads should produce fill commands with a
+ # length equal to the pattern word size
+ load 0x55.b > 0x200;
+ load 0x55aa.h > 0x400;
+ load 0x55aa66bb.w > 0x800;
+
+# load 0x55.b to 0x200;
+# load 0x55aa.h to 0x400;
+# load 0x55aa66bb.w to 0x800;
+
+# load 0x55.b @ 0x200;
+# load 0x55aa.h @ 0x400;
+# load 0x55aa66bb.w @ 0x800;
+
+# load $.text from hello @ .;
+# load hello$.text @ .;
+# load hello$* @ .
+
+ # this should produce a fill command with a length
+ # of 0x100
+ load 0x4c8e.h > 0x100..0x200;
+
+# load [ 0a 9b 77 66 55 44 33 22 11 00 ] @ 0x100;
+}
+
+# non-bootable section
+section (0x100) <= datasrc;
+
+#section (1K)
Home |
Main Index |
Thread Index |
Old Index