Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-31-2014, 03:14 AM   #1
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
Can someone please explain bind mounts to me?

I've been reading all over the web and still can't seem to get the info I want.

I want to make temporary changes to system files while a program is running.

For example, if I wanted to make a change to /usr/share/alsa/alsa.conf which is in the read-only system files, I want to "bind mount" and make a change to that file (with sed or whatever), then unmount it when I want. How do I do that?

I try:
touch alsa.conf
mount --bind /usr/share/alsa/alsa.conf alsa.conf
sed -ie s/cards.pcm.front/cards.pcm.default/g alsa.conf

error - cant move alsa.conf3ETwkI to alsa.conf -> obviously sed made a temp file and tried to move it to a read-only file.

Is this even possible? I'm thinking it's just the syntax I'm doing wrong?

edit: yep it's just the syntax. I made an edited rw file and can bind that to the ro system file.
ie: mount --bind bind/alsa.conf /usr/share/alsa/alsa.conf
that seems to work fine. I'll add it to my pianobar script...

Thanks anyway!

Last edited by brianinmaine; 10-31-2014 at 04:47 AM.
brianinmaine is offline   Reply With Quote
Old 10-31-2014, 05:27 AM   #2
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,189
Karma: 2116649
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
You're looking at it from the wrong direction. A bind mount will map something *onto* another thing (file or directory). Your problem, abstracted, is this:
- you do not want to change the root file system (very good idea)
- you want to have different file content in place of an existing file
So you should
- create a copy of the file in question (to the user store) and modify it so it has the content you want
- then bind-mount that file onto the file in the root file system (well, to be exact, to that excerpt of the virtual file system name space that is otherwise backed by the root file system)

PS: Ah, I only now see the your Edit (due to me not reading properly through the whole post). I leave my answer above, maybe it clears things up for others.
hawhill is offline   Reply With Quote
 
Advertisement
Old 11-27-2014, 02:45 AM   #3
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
So I was wrong again. How can I do this:
mount --bind pianobar/bind/lib/ao /usr/lib/ao
where /usr/lib/ao contains libraries but the directory doesn't exist on the Kindle.
In other words, can I bind mount to a place that doesn't exist yet somehow? I'm trying hard to not modify the system but just use bind mounts or something instead. Apparently the pianobar package doesn't work and I can't figure out how to fix without
"mntroot rw" and adding the files/directories?

I don't need someone to fix my package, just help me understand if this way of binding is possible. or is there a different way? I wish I could merge 2 directories?
brianinmaine is offline   Reply With Quote
Old 11-27-2014, 05:03 AM   #4
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,860
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Add the directory mount points to the Amazon image.
That is the least invasive that you can get in this situation.
**OR**
Use the PC utility attached to my "Hard Float on Kindle" thread, the patchelf utility.
Change the ELF headers in your application to make the dynamic loader stop searching /usr/lib/ao and to search /mnt/us/usr/lib/ao instead.

If you need a copy of patchelf built for something other than the host system I built my attachment for ...
Recent (2014.08 and 2014.11) versions of Buildroot will build patchelf for the host system you are using (it is now in the "Host Utilities" menu section).
knc1 is offline   Reply With Quote
Old 11-27-2014, 05:42 AM   #5
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
ah, OK thanks a lot! At least it gives me a direction to go!
brianinmaine is offline   Reply With Quote
Old 11-27-2014, 10:47 AM   #6
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,860
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by brianinmaine View Post
ah, OK thanks a lot! At least it gives me a direction to go!
I haven't done a specific write-up, but examples are contained in the attachments.

That is how I (propose) to run ARM Hard Float system libraries on an ARM Soft Float system.
Yup, Linux (an elf based system) can run multiple sets of system libraries at the same time.

The initial example contains hardfloat libraries and a couple of working applications (busybox and nano if I recall correctly).
And they are loading the HF libraries from "user storage".

Now if we can convince the 5.6.1 firmware's dynamic loader to do the same ....
knc1 is offline   Reply With Quote
Old 11-27-2014, 03:21 PM   #7
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,189
Karma: 2116649
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
then there's also LD_LIBRARY_PATH, an environment variable that, when set, can add to the search path of the linker. But somehow I'm puzzled that this is about a *subdirectory* of /usr/lib. The linker typically doesn't search there, so you might be facing the problem that some software does an dl("/usr/lib/ao/...") - and you can't fix that by patching the ELF files, since in that case, the library path is a string, not metadata of the ELF file. (Though technically, it might be in the strings section of the ELF, but now it's getting complicated...)
hawhill is offline   Reply With Quote
Old 11-27-2014, 07:09 PM   #8
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,860
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
The linker doesn't -
But the loader will, I have dozens of /usr/lib/* directories on my Linux distribution install.

The loader's places to search are listed in /etc/ld.so.conf (or /etc/ld.so.conf.d depending) and the paths to be searched are in the binary /etc/ld.so.cache (which is built by the ldconfig command).

But /etc/ld.so.conf(.d) is in the Amazon image, likely to be replaced by any update.

(*) The fact that the linker and the dynamic loader are both referred to as: 'ld' can confuse mere humans.
knc1 is offline   Reply With Quote
Old Yesterday, 01:23 AM   #9
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
After a bit of research, I found some ENV variables and stuff to try to keep system alters to a minimum. I only create one directory and populate it with a symlink to my libalsa.so file.

I'm also trying to understand how all the sound works on the Kindle. Playing a file with tts only seems to load libasound.so but no libalsa or anything like that? It seems some players like mplayer and the TTS play directly to the hw device /dev/snd/pcmC0D0p?
I guess pianobar does have libalsa as a dependency, but the file where I can list drivers for playback list null, au, wav, or alsa. I tried all the others and get 'cannot open audio device' but if I load alsa and link in libalsa.so I get it working fine. Audio under linux sure is complicated. I've now read dozens of pages with how this stuff seems to work - I still don't understand.

As an aside, should I have a link under KUAL to remove all traces of my alteration? Or just leave it in a README file?

I'll make changes to my package.

Thanks for all the info!

EDIT: I included a version of patchelf for my Kindle. It needs to go in /mnt/us/extensions and run the script called patchelf because it needs to load a library not on my Kindle... I could patch it with patchelf...
Attached Files
File Type: zip patchelf.zip (242.1 KB, 3 views)

Last edited by brianinmaine; Yesterday at 02:05 AM.
brianinmaine is offline   Reply With Quote
Old Yesterday, 02:11 AM   #10
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,860
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by brianinmaine View Post
A
- - - -
I guess pianobar does have libalsa as a dependency, but the file where I can list drivers for playback list null, au, wav, or alsa. I tried all the others and get 'cannot open audio device' but if I load alsa and link in libalsa.so I get it working fine.
- - - -
Hmm,
LD_DEBUG=libs <program name here>

Will make the dynamic loader output a listing of everything it looks for and where it is looking.
knc1 is offline   Reply With Quote
Old Yesterday, 04:55 AM   #11
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
Quote:
Originally Posted by knc1 View Post
Hmm,
LD_DEBUG=libs <program name here>

Will make the dynamic loader output a listing of everything it looks for and where it is looking.
Tried like this:
/mnt/us/extensions/pianobar/ # LD_LIBRARY_PATH=./lib:/usr/lib:/lib LD_DEBUG=libs bin/pianobar

I get lots of output, but none of it is the alsa stuff. Pianobar loads properly, I type in my email and password, select station and it starts to play - this is with the symlink to libalsa.so in /usr/lib/ao/plugins-4/libalsa.so pointing to the local copy. The output is all the libs loaded EXCEPT the libalsa.so library.

I can make it show more debug output by changing the word "quiet" to "debug" in my local file .libao (system file name is libao.conf). It then shows the loading path of libalsa.so by looking only in the plugins-4 folder. Maybe I can patch libao.so to load libalsa.so from a different place? I'll have to read up more on that...

EDIT:
Found the reference to /usr/lib/ao/plugins-4 in the configure file for the libao source package. So now I'll have to try to build that with an altered path. This is going to take a bit

Last edited by brianinmaine; Yesterday at 05:17 AM.
brianinmaine is offline   Reply With Quote
Old Yesterday, 05:33 AM   #12
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,860
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by brianinmaine View Post
Tried like this:
/mnt/us/extensions/pianobar/ # LD_LIBRARY_PATH=./lib:/usr/lib:/lib LD_DEBUG=libs bin/pianobar

I get lots of output, but none of it is the alsa stuff. Pianobar loads properly, I type in my email and password, select station and it starts to play - this is with the symlink to libalsa.so in /usr/lib/ao/plugins-4/libalsa.so pointing to the local copy. The output is all the libs loaded EXCEPT the libalsa.so library.
- - - - -
In that case, then it isn't dynamic load requirement, but instead an application resource loaded by dl(open) and friends.

The build linkage command should mention libdl (-dl) and this is at least one of the places its being used.

Hawhill had mentioned something about this earlier in this thread.

- - - - -

I read on, further than I quoted, and see you figured that one out and how to change the configuration of where it looks at runtime for its dlopen'd resources.

- - - - -

Just the same, this sort of failure forensics is one of those 'developer tricks' that sometimes has to be used.
knc1 is offline   Reply With Quote
Old Yesterday, 05:35 AM   #13
brianinmaine
Addict
brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.brianinmaine ought to be getting tired of karma fortunes by now.
 
brianinmaine's Avatar
 
Posts: 397
Karma: 1287365
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
Working to build it now - thanks for all the help!

EDIT:
all done - that was the issue. All I had to do was modify the pluginpath directory in the configure file and rebuild. I fixed the program and uploaded the new one. WOW it feels good to get that done well! I don't even need bind mounts at all now, as that's the title of this thread

Thanks again all for the help!

Last edited by brianinmaine; Yesterday at 06:12 AM.
brianinmaine is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Since Calibre v 0.9.14 PW mounts read-only! EightWeight Devices 4 01-18-2013 08:35 AM
Bind calibre-server to specific IP/interface Strupniveral Related Tools 3 03-21-2012 02:32 PM
umounting a mount --bind PoP Kindle Developer's Corner 4 04-15-2011 04:13 PM
Seriously thoughtful I'm in a bind Spoon Man Lounge 31 04-15-2010 11:45 PM
Accessories Idea for a battery-powered Kindle light that mounts in the USB port artsci Amazon Kindle 8 03-09-2009 02:37 PM


All times are GMT -4. The time now is 06:00 AM.


MobileRead.com is a privately owned, operated and funded community.