Gentoo Archives: gentoo-user

From: tuxic@××××××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [OT] Small and dirty 32 bit environment just to flash my Bus Pirate
Date: Wed, 19 Jul 2017 18:26:17
Message-Id: 20170719182557.stcbj4vd3rqc6dkl@solfire
In Reply to: Re: [gentoo-user] Re: [OT] Small and dirty 32 bit environment just to flash my Bus Pirate by Jorge Almeida
1 On 07/19 06:57, Jorge Almeida wrote:
2 > On Wed, Jul 19, 2017 at 6:40 PM, <tuxic@××××××.de> wrote:
3 >
4 > >
5 > > the tool is statically linked and only the command "file"
6 > > reveals its 32bit nature.
7 > >
8 > If the tool is a static binary, you shouldn't need anything besides a
9 > kernel with support for 32 bit executables (Executable file formats /
10 > Emulations ---> x32 ABI for 64-bit mode)
11 >
12 > (I hope I'm not saying something utterly silly...)
13 >
14 > Jorge Almeida
15 >
16
17 Hi,
18
19 the linux32-trick is neat...but it seems a little more to be done
20 here.
21
22 I straced the whole thing:
23 sudo strace linux32 ./pirate-loader_lnx
24
25
26 execve("/usr/bin/linux32", ["linux32", "./pirate-loader_lnx"], 0x7fff34dfea18 /* 18 vars */) = 0
27 brk(NULL) = 0x12ae000
28 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1148e8000
29 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
30 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
31 fstat(3, {st_mode=S_IFREG|0644, st_size=313119, ...}) = 0
32 mmap(NULL, 313119, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff11489b000
33 close(3) = 0
34 open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
35 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\3\2\0\0\0\0\0"..., 832) = 832
36 fstat(3, {st_mode=S_IFREG|0755, st_size=1652184, ...}) = 0
37 mmap(NULL, 3758296, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff114332000
38 mprotect(0x7ff1144bf000, 2093056, PROT_NONE) = 0
39 mmap(0x7ff1146be000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18c000) = 0x7ff1146be000
40 mmap(0x7ff1146c4000, 14552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff1146c4000
41 close(3) = 0
42 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff114899000
43 arch_prctl(ARCH_SET_FS, 0x7ff114899700) = 0
44 mprotect(0x7ff1146be000, 16384, PROT_READ) = 0
45 mprotect(0x602000, 4096, PROT_READ) = 0
46 mprotect(0x7ff1148ea000, 4096, PROT_READ) = 0
47 munmap(0x7ff11489b000, 313119) = 0
48 brk(NULL) = 0x12ae000
49 brk(0x12cf000) = 0x12cf000
50 open("/usr/lib64/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
51 fstat(3, {st_mode=S_IFREG|0644, st_size=4127728, ...}) = 0
52 mmap(NULL, 4127728, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff113f42000
53 close(3) = 0
54 uname({sysname="Linux", nodename="solfire", ...}) = 0
55 personality(PER_LINUX32) = 0 (PER_LINUX)
56 uname({sysname="Linux", nodename="solfire", ...}) = 0
57 execve("./pirate-loader_lnx", ["./pirate-loader_lnx"], 0x7fff1840a250 /* 18 vars */) = -1 ENOENT (No such file or directory)
58 write(2, "linux32: ", 9linux32: ) = 9
59 write(2, "./pirate-loader_lnx", 19./pirate-loader_lnx) = 19
60 write(2, ": ", 2: ) = 2
61 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
62 fstat(3, {st_mode=S_IFREG|0644, st_size=2997, ...}) = 0
63 read(3, "# Locale name alias data base.\n#"..., 4096) = 2997
64 read(3, "", 4096) = 0
65 close(3) = 0
66 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
67 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
68 open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
69 open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
70 open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
71 open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = 3
72 fstat(3, {st_mode=S_IFREG|0644, st_size=1474, ...}) = 0
73 mmap(NULL, 1474, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff1148e7000
74 close(3) = 0
75 write(2, "No such file or directory\n", 26No such file or directory
76 ) = 26
77 close(1) = 0
78 close(2) = 0
79 exit_group(1) = ?
80 +++ exited with 1 +++
81
82 Same happens, if I feed the whole glory of necessary commandline
83 switches and the hex-file into this little beast.
84
85 "No such file or directory."
86
87 Unfortunately I have no clue, what is missing here...
88 (and it is definetly no script, which #!<something> couldn't
89 be found.
90
91 Why does the task of flashing firmware walk hand in hand with mental illness so
92 near at the abyss of bricked hardware that often ?
93 Why can't it that easy as scripting plain TeX?
94 ;)
95
96 Cheers
97 Meino

Replies