View Single Post
Old 12-20-2012, 08:07 AM   #7
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Lets do one more and see what might go wrong.

I will do debians file

(apt-get install file inside debian if you don't have it)

(mount the ext.3 if it isn't already)
[root@kindle bin]# mount -o loop=/dev/loop/debian,noatime -t ext3 /mnt/base-us/debian.ext3 /mnt/debian

okay good to go

[root@kindle bin]# filechecker /mnt/debian/usr/bin/file
Quote:
copying /mnt/debian/usr/bin/file to /mnt/us/export/file/bin/file
Searching 937 user libs, 85 libs, 17 extended dirs
Spoiler:

libmagic.so.1
non native result /mnt/us/usr/lib/arm-linux-gnueabi/libmagic.so.1

libz.so.1
kindle supported at /usr/lib/libz.so.1.2.3
/usr/lib support detected

libc.so.6
kindle supported at /lib/libc.so.6
/lib support detected

ld-linux.so.3
kindle supported at /lib/ld-linux.so.3
/lib support detected

Export complete at /mnt/us/export/file ensure you run file like: cd /mnt/us/export/file/bin; LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH ./file
let's test it

[root@kindle bin]# cd /mnt/us/export/file/bin; LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH ./file ./file
Quote:
/etc/magic, 0: Warning: using regular magic file `/usr/share/misc/magic'
file: could not find any magic files!
ro ro! it don't work!!!
let's just hack the resources on to the root (they are tiny)
[root@kindle bin]# mntroot rw
[root@kindle bin]# mkdir -p /usr/share/misc/magic/
[root@kindle bin]# cp /mnt/debian/usr/share/misc/magic.mgc /usr/share/misc/magic.mgc
[root@kindle bin]# mntroot ro

and test it again

[root@kindle bin]# cd /mnt/us/export/file/bin; LD_LIBRARY_PATH=../lib:$LD_LIBRARY_PATH ./file ./file
Quote:
./file: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xb47ce3b5fc4138f5cc958deeeabeab1b1bb782a5, stripped
sweet. so yeah - that is the kind of thing that might go wrong.
not too tricky all in.

no doubt there will be cases where walking the required resource tree would be nice. parse a strace log maybe? : D

sed would have been a better solution for accessing the resources on the FAT drive.
patching the file binary to accept the new location

Anyways - hope this helps other forgetful developers.

HOW DO I MAKE INSTALL???

on my system (where my PATH includes /mnt/us/usr/bin and /mnt/us/usr/lib by default) to do a "make install" I would just

[root@kindle bin]# cp -r /mnt/us/export/file/* /mnt/us/usr/

where file is the name of the exported application. You could do something similar

Last edited by twobob; 12-20-2012 at 01:31 PM.
twobob is offline   Reply With Quote