diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/.gitignore | 1 | ||||
-rw-r--r-- | tools/Makefile | 4 | ||||
-rw-r--r-- | tools/buildman/README | 4 | ||||
-rw-r--r-- | tools/default_image.c | 21 | ||||
-rw-r--r-- | tools/mpc86x_clk.c | 202 | ||||
-rw-r--r-- | tools/patman/README | 11 | ||||
-rw-r--r-- | tools/patman/__init__.py | 3 | ||||
-rwxr-xr-x | tools/patman/patman.py | 25 | ||||
-rw-r--r-- | tools/patman/setup.py | 13 |
9 files changed, 65 insertions, 219 deletions
diff --git a/tools/.gitignore b/tools/.gitignore index 9bc9fecf7b..eb1a27e36d 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -11,7 +11,6 @@ /mkenvimage /mkimage /mkexynosspl -/mpc86x_clk /mxsboot /mksunxiboot /ncb diff --git a/tools/Makefile b/tools/Makefile index db55bcfab1..f673258bad 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -167,10 +167,6 @@ HOSTCFLAGS_md5.o := -pedantic HOSTCFLAGS_sha1.o := -pedantic HOSTCFLAGS_sha256.o := -pedantic -# Don't build by default -#hostprogs-$(CONFIG_PPC) += mpc86x_clk -#HOSTCFLAGS_mpc86x_clk.o := -pedantic - quiet_cmd_wrap = WRAP $@ cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@ diff --git a/tools/buildman/README b/tools/buildman/README index 8ecdd8f854..10c7135b5f 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -318,7 +318,7 @@ settings file to find them. To make this easier, buildman can automatically download and install toolchains from kernel.org. First list the available architectures: -$ ./tools/buildman/buildman sandbox --fetch-arch list +$ ./tools/buildman/buildman --fetch-arch list Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/ Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/ @@ -329,7 +329,7 @@ sparc sparc64 tilegx x86_64 xtensa Then pick one and download it: -$ ./tools/buildman/buildman sandbox --fetch-arch or32 +$ ./tools/buildman/buildman --fetch-arch or32 Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.3/ Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.6.2/ Checking: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.1/ diff --git a/tools/default_image.c b/tools/default_image.c index cf5c0d4393..18940af5b5 100644 --- a/tools/default_image.c +++ b/tools/default_image.c @@ -88,6 +88,9 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, struct image_tool_params *params) { uint32_t checksum; + char *source_date_epoch; + struct tm *time_universal; + time_t time; image_header_t * hdr = (image_header_t *)ptr; @@ -96,9 +99,25 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, sizeof(image_header_t)), sbuf->st_size - sizeof(image_header_t)); + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch != NULL) { + time = (time_t) strtol(source_date_epoch, NULL, 10); + + time_universal = gmtime(&time); + if (time_universal == NULL) { + fprintf(stderr, "%s: SOURCE_DATE_EPOCH is not valid\n", + __func__); + time = 0; + } else { + time = mktime(time_universal); + } + } else { + time = sbuf->st_mtime; + } + /* Build new header */ image_set_magic(hdr, IH_MAGIC); - image_set_time(hdr, sbuf->st_mtime); + image_set_time(hdr, time); image_set_size(hdr, sbuf->st_size - sizeof(image_header_t)); image_set_load(hdr, params->addr); image_set_ep(hdr, params->ep); diff --git a/tools/mpc86x_clk.c b/tools/mpc86x_clk.c deleted file mode 100644 index 9f662f73eb..0000000000 --- a/tools/mpc86x_clk.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (C) Copyright 2003 Intracom S.A. - * Pantelis Antoniou <panto@intracom.gr> - * - * This little program makes an exhaustive search for the - * correct terms of pdf, mfi, mfn, mfd, s, dbrmo, in PLPRCR. - * The goal is to produce a gclk2 from a xin input, while respecting - * all the restrictions on their combination. - * - * Generaly you select the first row of the produced table. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - - -#include <stdio.h> -#include <stdlib.h> - -#define DPREF_MIN 10000000 -#define DPREF_MAX 32000000 - -#define DPGDCK_MAX 320000000 -#define DPGDCK_MIN 160000000 - -#define S_MIN 0 -#define S_MAX 2 - -#define MFI_MIN 5 -#define MFI_MAX 15 - -#define MFN_MIN 0 -#define MFN_MAX 15 - -#define MFD_MIN 0 -#define MFD_MAX 31 - -#define MF_MIN 5 -#define MF_MAX 15 - -#define PDF_MIN 0 -#define PDF_MAX 15 - -#define GCLK2_MAX 150000000 - -static int calculate (int xin, int target_clock, - int ppm, int pdf, int mfi, int mfn, int mfd, int s, - int *dprefp, int *dpgdckp, int *jdbckp, - int *gclk2p, int *dbrmop) -{ - unsigned int dpref, dpgdck, jdbck, gclk2, t1, t2, dbrmo; - - /* valid MFI? */ - if (mfi < MFI_MIN) - return -1; - - /* valid num, denum? */ - if (mfn > 0 && mfn >= mfd) - return -1; - - dpref = xin / (pdf + 1); - - /* valid dpef? */ - if (dpref < DPREF_MIN || dpref > DPREF_MAX) - return -1; - - if (mfn == 0) { - dpgdck = (2 * mfi * xin) / (pdf + 1) ; - dbrmo = 0; - } else { - /* 5 <= mfi + (mfn / mfd + 1) <= 15 */ - t1 = mfd + 1; - t2 = mfi * t1 + mfn; - if ( MF_MIN * t1 > t2 || MF_MAX * t1 < t2) - return -1; - - dpgdck = (unsigned int)(2 * (mfi * mfd + mfi + mfn) * - (unsigned int)xin) / - ((mfd + 1) * (pdf + 1)); - - dbrmo = 10 * mfn < (mfd + 1); - } - - /* valid dpgclk? */ - if (dpgdck < DPGDCK_MIN || dpgdck > DPGDCK_MAX) - return -1; - - jdbck = dpgdck >> s; - gclk2 = jdbck / 2; - - /* valid gclk2 */ - if (gclk2 > GCLK2_MAX) - return -1; - - t1 = abs(gclk2 - target_clock); - - /* XXX max 1MHz dev. in clock */ - if (t1 > 1000000) - return -1; - - /* dev within range (XXX gclk2 scaled to avoid overflow) */ - if (t1 * 1000 > (unsigned int)ppm * (gclk2 / 1000)) - return -1; - - *dprefp = dpref; - *dpgdckp = dpgdck; - *jdbckp = jdbck; - *gclk2p = gclk2; - *dbrmop = dbrmo; - - return gclk2; -} - -int conf_clock(int xin, int target_clock, int ppm) -{ - int pdf, s, mfn, mfd, mfi; - int dpref, dpgdck, jdbck, gclk2, xout, dbrmo; - int found = 0; - - /* integer multipliers */ - for (pdf = PDF_MIN; pdf <= PDF_MAX; pdf++) { - for (mfi = MFI_MIN; mfi <= MFI_MAX; mfi++) { - for (s = 0; s <= S_MAX; s++) { - xout = calculate(xin, target_clock, - ppm, pdf, mfi, 0, 0, s, - &dpref, &dpgdck, &jdbck, - &gclk2, &dbrmo); - if (xout < 0) - continue; - - if (found == 0) { - printf("pdf mfi mfn mfd s dbrmo dpref dpgdck jdbck gclk2 exact?\n"); - printf("--- --- --- --- - ----- ----- ------ ----- ----- ------\n"); - } - - printf("%3d %3d --- --- %1d %5d %9d %9d %9d %9d%s\n", - pdf, mfi, s, dbrmo, - dpref, dpgdck, jdbck, gclk2, - gclk2 == target_clock ? " YES" : ""); - - found++; - } - } - } - - /* fractional multipliers */ - for (pdf = PDF_MIN; pdf <= PDF_MAX; pdf++) { - for (mfi = MFI_MIN; mfi <= MFI_MAX; mfi++) { - for (mfn = 1; mfn <= MFN_MAX; mfn++) { - for (mfd = 1; mfd <= MFD_MAX; mfd++) { - for (s = 0; s <= S_MAX; s++) { - xout = calculate(xin, target_clock, - ppm, pdf, mfi, mfn, mfd, s, - &dpref, &dpgdck, &jdbck, - &gclk2, &dbrmo); - if (xout < 0) - continue; - - if (found == 0) { - printf("pdf mfi mfn mfd s dbrmo dpref dpgdck jdbck gclk2 exact?\n"); - printf("--- --- --- --- - ----- ----- ------ ----- ----- ------\n"); - } - - printf("%3d %3d %3d %3d %1d %5d %9d %9d %9d %9d%s\n", - pdf, mfi, mfn, mfd, s, - dbrmo, dpref, dpgdck, jdbck, gclk2, - gclk2 == target_clock ? " YES" : ""); - - found++; - } - } - } - - } - } - - return found; -} - -int main(int argc, char *argv[]) -{ - int xin, want_gclk2, found, ppm = 100; - - if (argc < 3) { - fprintf(stderr, "usage: mpc86x_clk <xin> <want_gclk2> [ppm]\n"); - fprintf(stderr, " default ppm is 100\n"); - return 10; - } - - xin = atoi(argv[1]); - want_gclk2 = atoi(argv[2]); - if (argc >= 4) - ppm = atoi(argv[3]); - - found = conf_clock(xin, want_gclk2, ppm); - if (found <= 0) { - fprintf(stderr, "cannot produce gclk2 %d from xin %d\n", - want_gclk2, xin); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/tools/patman/README b/tools/patman/README index 27ec90acc8..5bd74c4f83 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -135,6 +135,17 @@ Similar to the above, but skip the first commit and take the next 5. This is useful if your top commit is for setting up testing. +How to install it +================= + +The most up to date version of patman can be found in the U-boot sources. +However to use it on other projects it may be more convenient to install it as +a standalone application. A distutils installer is included, this can be used +to install patman: + +$ cd tools/patman && python setup.py install + + How to add tags =============== diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py new file mode 100644 index 0000000000..7cbe5fa4b0 --- /dev/null +++ b/tools/patman/__init__.py @@ -0,0 +1,3 @@ +__all__ = ['checkpatch', 'command', 'commit', 'cros_subprocess', + 'get_maintainer', 'gitutil', 'patchstream', 'project', + 'series', 'settings', 'terminal', 'test'] diff --git a/tools/patman/patman.py b/tools/patman/patman.py index 6c6473e462..6fe8fe068c 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -14,14 +14,18 @@ import sys import unittest # Our modules -import checkpatch -import command -import gitutil -import patchstream -import project -import settings -import terminal -import test +try: + from patman import checkpatch, command, gitutil, patchstream, \ + project, settings, terminal, test +except ImportError: + import checkpatch + import command + import gitutil + import patchstream + import project + import settings + import terminal + import test parser = OptionParser() @@ -70,8 +74,11 @@ specified by tags you place in the commits. Use -n to do a dry run first.""" settings.Setup(parser, options.project, '') (options, args) = parser.parse_args() +if __name__ != "__main__": + pass + # Run our meagre tests -if options.test: +elif options.test: import doctest sys.argv = [sys.argv[0]] diff --git a/tools/patman/setup.py b/tools/patman/setup.py new file mode 100644 index 0000000000..e61804f178 --- /dev/null +++ b/tools/patman/setup.py @@ -0,0 +1,13 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# +from distutils.core import setup +setup(name='patman', + version='1.0', + license='GPL-2.0+', + scripts=['patman'], + packages=['patman'], + package_dir={'patman': ''}, + package_data={'patman': ['README']}, + classifiers=['Environment :: Console', + 'Topic :: Software Development']) |