![]() |
#16 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Okay, I did come to the point I have the new .SQSH file ready.
What I do not understand: Why not just overwrite the old SQSH-file on the reader? Question answered: du to safety-reasons. Better not bricking the reader. Is it possible and your solution is a safety-thing? When mounting the new file with the script (which I do not have a glue how to do that yet) - what's the principle? Mounting the new file, and then? Are there then TWO .SQSH-file son the reader? Or ist there a second step necessary, which I guess is to overwrite the original file, restart, delete script and new file number one? Edit: question answered 100% in next post! Last edited by Analogus; 01-15-2017 at 11:41 AM. |
![]() |
![]() |
![]() |
#17 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
The point is, to allow the system to boot and run normally without automating any un-tested changes.
I don't have your device/firmware combination so all I can do is give an example with made-up names. Normal: The initialization scripting (up-start) will, at some point, issue: losetup /dev/loop/3 /our/protected/from/change/company/fonts.file mount /dev/loop/3 /usr/java/lib/fonts. The first translates a file into a storage device. The second grafts the file system on that storage device into the system tree. Now the folders and files contained inside of the squashfs file, fonts.file, appear to be (actually, are) part of the over-all file system tree. The system continues to boot until normal completion. One of the properties of an inode file system (both your Kindle and your MacOSx box) is this ability to use any existing directory entry in the tree to mount the file system contained on another backing store (which was done above). Now what happens if you mount ANOTHER file system on a different backing store at the same (/usr/java/lib/fonts) mount point? For new accesses, only the newest file system mounted (think, the 'top' one) can be seen by the rest of the system. For any files open on the first ('bottom') one, the I/O continues to the original one (for more or less the same reason that you can still use a 'deleted' file if it was open before the delete). So to get the system to start using the files in the new ('top') system you just over-mounted the old one with, you have to prod the system into closing all files that might have been open at the time. Hence the 'restart cvm' step (it, or its children (anything 'Java')) are most likely the things that would have the old files either open or cached or both. Also, it is my guess that all of the file system (a very basic thing) happened in the start-up sequence long before cvm was started. I.E: restarting cvm will not trigger a file system tree creation that would wipe out your second mount (with a third) ![]() Now, how do you do this 'change-over' script? # You need to find the next available loop device: nxt=$(losetup -f) # You have to use that loop device to translate your new file into a device losetup /var/local/my/new/fonts.new $nxt # Then you have to mount the new device on top of the existing system at that mount point mount -t squashfs $nxt /usr/java/lib/fonts # Make cvm and its children let go of the old (now 'bottom') layer files initctl stop cvm # Get everything just stopped, re-started again initctl start cvm And put that into a manually executed (by you) script. That way, only you can brick the device and you can un-brick it using the power button to force a re-boot. If you had the initialization system use your un-tested font file automatically, you could only find errors by noticing that the Kindle had automatically bricked, with no way other than using the serial port to un-brick it. The Kindle OS is traditionally super-sensitive to font files. People who don't leave themselves an 'out' when changing font files around are putting the Kindle on a short path to suicide. Note: You would need to confirm each line of the above proposed script on the command line, just to be sure I got all the names correct and did not typo anything. OH, .... not shown above, how to un-mount something: umount /dev/loop/whatever number and getting rid of a loop_device losetup -d /dev/loop/whatever_number Remember: The 'man'(ual) command is your friend: On a system with the manuals installed (or in your web browser search engine or your MacOSx termina, if your Mac supports the commands): man losetup man mount Last edited by knc1; 01-14-2017 at 09:41 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Thank You! Will take it's time.
![]() But one question before to start, I think the answer can be very short: How do I make a script(file) and start it? I guess making a new file (ending -sh I presume) and putting it somewhere? Calling the scriptfile over the searching-entry on the reader? Or do I have to install a terminal-hack or something else? In short: How do I call a script on a kindle? Edit: solved (using kterm now). Calling the script: go to the right folder with Kterm, type: ./NameOfScript Greetings Edit: Script is on the way. Next problem: I am not able to copy files lager than 50MB onto the reader! Edit: solved: several folders allow plenty of new files. For example: - /opt/ - /opt/amazon/ (seems to be a good place to store the image-file) - /dev/ - /dev/loop/ (be carefull, files will be deleted after reboot) As mentioned above - this gets really frustrating. I do file transfer with MAC an the APP called Transfer mentioned by the OP in the first post. Works well so far until now. But each file larger than 50MB in every writeable folder on the reader is rejected by interrupting the copy-process. Any idea? Would it work to copy the file onto /mnt/us/? 50 MB is no Problem there of course. Edit: still unclear Last edited by Analogus; 01-15-2017 at 02:35 PM. |
![]() |
![]() |
![]() |
#19 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
http://tldp.org/LDP/abs/html/
The command line application on the Kindle is Busybox Ash, a simplified version of Bash (which is probably on your MacOSx box). ((Yes, you will find my name in that one.)) and also: http://linuxcommand.org/ ** ((untouched by myself)) Copy it where? (as in full pathname of destination). The Kindle has fixed size partitions, all except user storage is nearly full. The device is very likely to brick if they are actually filled up. There needs to be room for the system to survive its file system checks during boot up. See if you have the 'free' command on the Kindle. You had better install kTerm the direction you are going in. No, it is not a 'hack', it is a commonly used PC application ported to the Kindle. 'Hack' is just another four letter word. ** second page, first para: zsh is included with USBnetworking package ** second page, second para: xterm - the kTerm program before being ported to the Kindle. ** Yes, somewhere we have a build of Bash for the Kindles also. Last edited by knc1; 01-15-2017 at 09:17 AM. |
![]() |
![]() |
![]() |
#20 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Thanks for your answer!
You seem to be a jack of all trades! ![]() I for my part am not. I give up. Installed terminal --> working. Made script --> calling script in principle OK. Copied altered sqsh-image onto the user area due to lack of space in other directories. Path: /mnt/us/test/ Copied script into the same directory to make things easier. I presume, that the user-area is /mtn/us/ Script: Code:
# You need to find the next available loop device: nxt=$(losetup -f) echo "$nxt" # You have to use that loop device to translate your new file into a device losetup /mnt/us/test/fonts.sqsh $nxt # Then you have to mount the new device on top of the existing system at that mount point mount -t squashfs $nxt /usr/java/lib/fonts # Make cvm and its children let go of the old (now 'bottom') layer files initctl stop cvm # Get everything just stopped, re-started again initctl start cvm losetup: /mnt/us/test/fonts.sqsh: No such file or directory Of course there IS this directory and the file, even beeing there with the shell, and script is able to be called up. It seems to be that the file is unable beeing mountet from the user-space. Thanks for your help - I learned a couple of things. |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Hmm...
You can't display user storage on the PC and use it internally at the same time. Add a Code:
ls -l /mnt/us/test/* That is lower case ell. See if it gives a similar error message. (and mention the output of the echo command please) Translation: It is best to do the testing from kTerm, then you'll know immediately if /mnt/us is visible inside of the system. = = = = = Just left-over bits of trivia from doing this for a 1/2 century. = = = = = The long answers are because there are a lot of people who use this forum as a read-only resource. Last edited by knc1; 01-15-2017 at 11:46 AM. |
![]() |
![]() |
![]() |
#22 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Nope - not running.
I do this commands in Kterm - I do not know another way. Lines below are typed by hand ;-) Directory is visible in Kterm when using CD and LS... It makes no difference wether the reader is on the Mac or not. [test]# ./fontnew.sh /dev/loop0 -rwxrwxrwx 1 root root 507 Jan 15 17:43 /mnt/us/test/fontnew.sh -rwxrwxrwx 1 root root 72507392 Jan 15 11:52 /mnt/us/test/font.sqsh losetup: /mnt/us/test/fonts.sqsh: No such file or directory ... Last edited by Analogus; 01-15-2017 at 11:59 AM. |
![]() |
![]() |
![]() |
#23 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
It returning the lowest available loop number rather than next highest. But in the Amazon OS, loop/0 and loop/1 are reserved for special purposes. list the contents of /dev/loop/* try using the loop device number one greater than that shown. (IIRC - Amazon OS is set to create loop devices as requested) if not, use the Code:
losetup /dev/loop/Largest_Number However you find it, hardcode that loop device number into the script. |
|
![]() |
![]() |
![]() |
#24 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Nope...
Always the same error message: losetup: /mnt/us/test/fonts.sqsh: No such file or directory I tried different numbers for loop (17 is the next free number, 0 - 16 are in use). Besides: I think there is an error in the original script with the variable: nxt=$(losetup -f) returnes /dev/loop0 not /dev/loop/0 But i fixed it by hand as you can see in the code - you can observe the variations I used: Code:
# You need to find the next available loop device: # nxt=$(losetup -f) # echo "$nxt" #error? # You have to use that loop device to translate your new file into a device # ls -l /mnt/us/test/* # losetup /mnt/us/test/fonts.sqsh $nxt losetup /mnt/us/test/fonts.sqsh /dev/loop/17 # losetup /mnt/us/test/fonts.sqsh /dev/loop/Largest_Number # losetup /dev/loop/Largest_Number # Then you have to mount the new device on top of the existing system at that mount point # mount -t squashfs $nxt /usr/java/lib/fonts # mount -t squashfs /dev/loop/17 /usr/java/lib/fonts # Make cvm and its children let go of the old (now 'bottom') layer files # initctl stop cvm # Get everything just stopped, re-started again # initctl start cvm Edit: There is a conundrum with the path. I managed to copy the file on /opt/fonts.sqsh Using this command: Code:
losetup /opt/fonts.sqsh /dev/loop/17 Same return: there is no... Last edited by Analogus; 01-15-2017 at 12:58 PM. |
![]() |
![]() |
![]() |
#25 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
I typo'd the losetup command, interchange the two arguments.
Ref (web search engine): man losetup |
![]() |
![]() |
![]() |
#26 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 568
Karma: 2170348
Join Date: Apr 2011
Device: 2x Sony PRS-350; PRS-300 (†), Paperwhite (†), Voyage
|
Figured that out meanwhile. Renamed it to be quicker. But no luck...
Even when typing this commands directly into Kterm even when in folder /opt/ no luck. Filename without path - no luck. I'm now on this 4: Code:
losetup /opt/f.sqsh /dev/loop17 losetup /dev/loop17 /opt/f.sqsh losetup /opt/f.sqsh /dev/loop/17 losetup /dev/loop/17 /opt/f.sqsh If I make an empty file '17' in .../loop/ then the error-message is gone. Instead another error-message going like 'losetup inappropriate ioctl for device'... Suggestion: Let it be - thank you for your patience and great help. ![]() Edit: giving up on the topic: mounting sqsh-image into Kindle file system. Still unsolved for me Last edited by Analogus; 01-15-2017 at 02:29 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
usbnetwork | Aerus | Amazon Kindle | 2 | 06-18-2011 08:34 PM |
usbNetwork on 2.5.3? | Gnewt | Kindle Developer's Corner | 2 | 07-12-2010 01:32 PM |
Hacks I want usbnetwork for 2.5.2 | al3bsi | Amazon Kindle | 4 | 06-18-2010 12:55 PM |
How do I mount Kindle DX rootfs on a Mac - usbNetwork needed? | software.enginee | Kindle Developer's Corner | 14 | 06-08-2010 03:20 PM |
Firmware Update USBNetwork and 2.3 Update? | ChinaLamb | Amazon Kindle | 4 | 12-04-2009 06:13 AM |