diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/poky-nokia800-flashutil | 64 | ||||
-rwxr-xr-x | scripts/pstage-scanner | 136 |
2 files changed, 0 insertions, 200 deletions
diff --git a/scripts/poky-nokia800-flashutil b/scripts/poky-nokia800-flashutil deleted file mode 100755 index f1ffa5ae6f..0000000000 --- a/scripts/poky-nokia800-flashutil +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | # Copyright (C) 2008 OpenedHand Ltd. | ||
3 | # Contact: andrew@openedhand.com | ||
4 | # | ||
5 | # Erase the partition given in $3 (default: rootfs) and flash the contents | ||
6 | # of image given in $1 into the image $2. | ||
7 | |||
8 | if [ ! -r "$1" ]; then | ||
9 | echo "Usage: $0 <image> <destimage> [<partition>]" | ||
10 | exit -1 | ||
11 | fi | ||
12 | |||
13 | uboot_offset=0 | ||
14 | config_offset=64 | ||
15 | kernel_offset=256 | ||
16 | initfs_offset=1280 | ||
17 | rootfs_offset=2304 # chinook | ||
18 | |||
19 | # This value should be selected for Diablo based firmwares | ||
20 | # It also require patching qemu to get proper size of flash partitions | ||
21 | # (by default qemu has Chinook split). | ||
22 | #rootfs_offset=3328 # diablo | ||
23 | |||
24 | if [ ! -e "$2" ]; then | ||
25 | echo "foo" | ||
26 | # Making an empty/erased flash image. Need a correct echo behavior. | ||
27 | dd if=/dev/zero of=$2 bs=268435456 count=0 seek=1 | ||
28 | bash -c 'echo -en \\0377\\0377\\0377\\0377\\0377\\0377\\0377\\0377 > .8b' | ||
29 | cat .8b .8b > .16b # OOB is 16 bytes | ||
30 | cat .16b .16b .16b .16b .16b .16b .16b .16b > .8sec | ||
31 | cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec | ||
32 | cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec | ||
33 | cat .512sec .512sec .512sec .512sec > .2ksec | ||
34 | cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16k | ||
35 | cat .16k .16k .16k .16k .16k .16k .16k .16k > .128k | ||
36 | # N800 NAND is 512k sectors big | ||
37 | cat .128k .128k .128k .128k >> $2 | ||
38 | rm -rf .8b .16b .8sec .64sec .512sec .2ksec .16k .128k | ||
39 | fi | ||
40 | |||
41 | if [ "$3" != "" ]; then | ||
42 | case "$3" in | ||
43 | config) | ||
44 | partition=/dev/mtd1 | ||
45 | page=$config_offset | ||
46 | ;; | ||
47 | initfs) | ||
48 | partition=/dev/mtd3 | ||
49 | page=$initfs_offset | ||
50 | ;; | ||
51 | rootfs) | ||
52 | partition=/dev/mtd4 | ||
53 | page=$rootfs_offset | ||
54 | ;; | ||
55 | *) | ||
56 | echo "Unknown partition $2" | ||
57 | exit -1 | ||
58 | esac | ||
59 | else | ||
60 | partition=/dev/mtd4 | ||
61 | page=$rootfs_offset | ||
62 | fi | ||
63 | |||
64 | dd if=$1 of=$2 conv=notrunc bs=2048 seek=$page | ||
diff --git a/scripts/pstage-scanner b/scripts/pstage-scanner deleted file mode 100755 index 4a27aa5d26..0000000000 --- a/scripts/pstage-scanner +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | ## | ||
4 | ## This script will scan all of the packages in PSTAGE_DIR (or argv[1]) | ||
5 | ## in search of packages which install files outside of their native sysroot | ||
6 | ## | ||
7 | |||
8 | import os, sys, tarfile, shutil | ||
9 | import subprocess as sub | ||
10 | |||
11 | logf = "" | ||
12 | pcount = 0 | ||
13 | ecount = 0 | ||
14 | |||
15 | def main(): | ||
16 | """Generate a list of pstage packages and scan them for badness""" | ||
17 | package_list = [] | ||
18 | |||
19 | try: | ||
20 | path = sysv.arg[1] | ||
21 | except: | ||
22 | # Assume pstage is a child of tmp, Poky's default | ||
23 | tmpdir = None | ||
24 | sub.Popen(["bitbake", "-e"], stdout=sub.PIPE,stderr=sub.PIPE) | ||
25 | err, out = p.communicate() | ||
26 | if (!out): | ||
27 | print("bitbake not in your environment, try pstage-scanner /some/path/to/pstage") | ||
28 | exit | ||
29 | for line in out: | ||
30 | if line.find("PSTAGE_DIR=") != -1: | ||
31 | tmpdir = line.partition("=")[2].strip("\"") | ||
32 | break | ||
33 | |||
34 | if len(path) < 1 or not os.path.exists(path): | ||
35 | print ("No path defined and bitbake not in your environment, try pstage-scanner /some/path/to/pstage") | ||
36 | exit | ||
37 | |||
38 | global logf | ||
39 | try: | ||
40 | logf = sys.argv[2] | ||
41 | except: | ||
42 | logf = os.path.join(path, "pstage-scanner.log") | ||
43 | |||
44 | ## Create a working directory | ||
45 | tempdir = os.path.join(path, "tmp") | ||
46 | os.mkdir(tempdir) | ||
47 | |||
48 | ## Iterate each child of the target directory looking for .ipk files and | ||
49 | ## building a list of files to process | ||
50 | for root, dirs, files in os.walk(path): | ||
51 | for d in dirs: | ||
52 | for f in os.listdir(os.path.join(root,d)): | ||
53 | if os.path.splitext(f)[1] == ".ipk" and f.find("native") == -1 and f.find("cross") == -1: | ||
54 | package_list.append(os.path.join(root,d,f)) | ||
55 | |||
56 | ## Next we iterate our built list of files and process each package | ||
57 | for pkg in package_list: | ||
58 | tmp = os.path.join(tempdir, os.path.splitext(os.path.split(pkg)[1])[0]) | ||
59 | os.mkdir(tmp) | ||
60 | scan_package(pkg, tmp) | ||
61 | |||
62 | ## Tidy up working directory | ||
63 | shutil.rmtree(tempdir) | ||
64 | |||
65 | ## Report a summary | ||
66 | log("Finished scanning packaged staging. Scanned %i packages with %i errors" % (pcount, ecount)) | ||
67 | |||
68 | def scan_package(filepath, parentdir): | ||
69 | """Helper method to do bookkeeping, passes all installable directories to | ||
70 | scan_dir which does the actual scanning.""" | ||
71 | os.chdir(parentdir) | ||
72 | |||
73 | ## increment the package count, for the summary | ||
74 | global pcount | ||
75 | pcount += 1 | ||
76 | |||
77 | ## An ipk file is an ar archive containing two gzipped tarball directories | ||
78 | ## data.tar.gz is inflated to / and contains the actual files | ||
79 | ## control.tar.gz is metadata and scripts for the package | ||
80 | ## The archive also contains a file, debian binary, which is unused | ||
81 | ## Python can't handle ar archives ootb. So we cheat and inflate with | ||
82 | ## the ar program on the host | ||
83 | sub.call(["ar", "x", filepath]) | ||
84 | |||
85 | ## The things we care about are in data.tar.gz | ||
86 | tgz = tarfile.open(os.path.join(parentdir, "data.tar.gz")) | ||
87 | dest = os.path.join(parentdir, "inflate") | ||
88 | os.mkdir(dest) | ||
89 | tgz.extractall(dest) | ||
90 | |||
91 | ## We want to know the target arch so that we can ensure the package is | ||
92 | ## only installing into its target sysroot | ||
93 | arch = os.path.splitext(os.path.basename(filepath))[0].split("_")[-1] | ||
94 | if arch == "64": | ||
95 | arch = "x86_64" | ||
96 | |||
97 | ## The ignored list contains directories we don't care to scan | ||
98 | ignored = ["pkgdata", "stamps", "deploy"] | ||
99 | |||
100 | ## Scan the package for badness | ||
101 | pname = os.path.split(filepath)[1] | ||
102 | for di in os.listdir(dest): | ||
103 | if di not in ignored: | ||
104 | scan_dir(os.path.join(dest, di), arch, pname) | ||
105 | |||
106 | def scan_dir (directory, arch, package_name): | ||
107 | """Scan the contents of directory for things installing outside of native | ||
108 | sysroot""" | ||
109 | |||
110 | global ecount | ||
111 | msg = "" | ||
112 | |||
113 | head, tail = os.path.split(directory) | ||
114 | if not tail == "sysroots": | ||
115 | msg += "Tsk tsk, installing to " + tail + "\n" | ||
116 | for d in os.listdir(directory): | ||
117 | msg += "Installing %s in %s" % (d, tail) + "\n" | ||
118 | ecount += 1 | ||
119 | else: | ||
120 | for d in os.listdir(directory): | ||
121 | if not d.startswith(arch) and d.find("fixmepath") == -1: | ||
122 | msg += "Tsk tsk, installing into non-native sysroot " + os.path.join(directory, d) | ||
123 | ecount += 1 | ||
124 | |||
125 | if len(msg) > 0: | ||
126 | log("Scanning package " + package_name + "\n" + msg) | ||
127 | |||
128 | def log (message): | ||
129 | global logf | ||
130 | logfile = open (logf, 'a+') | ||
131 | logfile.write(message + "\n") | ||
132 | print "LOG: " + message | ||
133 | logfile.close() | ||
134 | |||
135 | if __name__ == "__main__": | ||
136 | main() | ||