09-12-2019, 08:42 PM | #1 | |
Member
Posts: 17
Karma: 222284
Join Date: Jul 2018
Device: PW3
|
Kernel development / no kexec syscall
Hi,
so my PW3 is on firmware 5.10.1.1 currently, and the kexec syscall is disabled (it seems like it was enabled some time ago https://wiki.mobileread.com/wiki/Kin...el_Development ). So ideally I'd like a solution that doesn't require flashing to boot another kernel (so that it can be distributed without bricking people's devices), but it should also work without a pc. To start out I'd also like to try the tethered variant as well (I can't find it right now but I read somewhere that using the bootloader a kernel can also just be written into RAM and booted from there). This is probably the most stupid question but in this guide Quote:
To boot another kernel without a kernel and without the kexec syscall enabled, there seems to be the possibility to make kexec a module, which can then be loaded. See this: https://github.com/amonakov/kexec-module But I just can't get the .ko out of it. I cloned the repo besides the kernel folder (the latter I build already) and modified the Makefile for the kernel part in the following way: Code:
[simon@yogal390 kernel]$ cat Makefile KDIR ?= ../../linux-3.0.35 ARCH ?= arm MYPWD ?= /home/simon/Downloads/gplrelease/kexec-module/kernel default: orig $(MAKE) -C $(KDIR) -I$(MYPWD) orig: mkdir $@ ln -s $(KDIR)/arch/$(ARCH)/kernel/relocate_kernel.S ln -s $(KDIR)/arch/$(ARCH)/kernel/machine_kexec.c $@/ ln -s $(KDIR)/kernel/kexec.c $@/ Code:
[simon@yogal390 kernel]$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- make -C ../../linux-3.0.35 -I/home/simon/Downloads/gplrelease/kexec-module/kernel make[1]: Verzeichnis „/home/simon/Downloads/gplrelease/linux-3.0.35“ wird betreten CHK include/linux/version.h CHK include/generated/utsrelease.h make[2]: „include/generated/mach-types.h“ ist bereits aktuell. CALL scripts/checksyscalls.sh CHK include/generated/compile.h Kernel: arch/arm/boot/Image is ready SHIPPED arch/arm/boot/compressed/lib1funcs.S AS arch/arm/boot/compressed/lib1funcs.o LD arch/arm/boot/compressed/vmlinux OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready Building modules, stage 2. MODPOST 36 modules make[1]: Verzeichnis „/home/simon/Downloads/gplrelease/linux-3.0.35“ wird verlassen [simon@yogal390 kernel]$ ls built-in.o kexec.c kexec-mod.h Makefile relocate_kernel.S Kbuild kexec-drv.c machine_kexec.c orig What this approach stems from is the kindle fire actually: https://forum.xda-developers.com/ama...-ford-t3270272 Has anybody toyed with stuff like this since the kexec syscall is gone? How have you gone about it? Essentially I just want to boot a kernel with the risk of permanent damage |
|
09-13-2019, 03:02 AM | #2 |
Evangelist
Posts: 415
Karma: 750442
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
|
As far as i remember, PW3 has no "magic key"
|
Advert | |
|
09-14-2019, 01:33 PM | #3 | |
Zealot
Posts: 147
Karma: 20
Join Date: Jul 2019
Device: Kindle Touch (K5) Wi-Fi x 2, Kindle (7th Gen, KT2), Paperwhite 3rd Gen
|
Correct. The last device with the Magic Key was the Kindle Touch. On newer devices, it's either serial port access to U-Boot -or- pre-existing jailbreak and the idme command.
Quote:
|
|
09-16-2019, 10:23 AM | #4 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Both u-boot and the kernel are both network filesystem enabled.
"not requiring a pc" :: *) use your NSS which is part of most home routers. *) put the network filesystem on a cloud server *) use a Linux, Mac, or (*)BSD system PS: DO NOT put swap on the network filesystem, the Kindle kernels are not configured to support such use (we have threads on that subject here). |
09-18-2019, 01:56 PM | #5 | |
Zealot
Posts: 147
Karma: 20
Join Date: Jul 2019
Device: Kindle Touch (K5) Wi-Fi x 2, Kindle (7th Gen, KT2), Paperwhite 3rd Gen
|
Quote:
|
|
Advert | |
|
03-20-2020, 05:08 PM | #6 |
Member
Posts: 10
Karma: 10
Join Date: Mar 2020
Device: Kindle PW3
|
Just noticed this thread.
I'm very interested in working to get a newer kernel booting on PW3, and would like a method that allows testing kernels with low risk of bricking. I hadn't heard of idme until now, and didn't know kindles had fastboot. @WaseemAlkurdi Is this the same fastboot from Android world? Can I use the standard android fastboot util to send an image with fastboot boot? |
03-20-2020, 05:35 PM | #7 |
Member
Posts: 10
Karma: 10
Join Date: Mar 2020
Device: Kindle PW3
|
oic, fastboot requires soldering to usb serial pads.
|
03-20-2020, 08:32 PM | #8 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
It is available on this forum. I do not have a link to it. *) What size image? The "Kindle fastboot" can not handle the size of the 'main' file system image. *) Fastboot boot: Haven't heard it mentioned, give it a try. Let us know the details of your new brick. *) Hot soldering to serial port is not requited. You do have to connect to the serial port, but the serial port thread contains at least three ways to avoid use of hot solder. *) Low risk testing: both the startup of the Kindle's u-boot and of the Kindle's kernel support network filesystems. That is: boot from an external source, if it breaks, don't boot from an external source next time. That is the way 'real' embedded devices are developed. Last edited by knc1; 03-21-2020 at 03:14 PM. |
|
10-08-2020, 02:20 PM | #9 |
rm -rf /
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
An update to this - it's fairly trivial to build a kernel with the kexec call and /proc/atags enabled, but I've not been able to use the userspace tools to switch to a different kernel. Here are the steps that you should follow if you want to try this yourself; I used NiLuJe's toolchain for this.
There's 2 versions of this with differing features - one is from v2.0.3 and the other from v2.0.7. The latter requires you to specify the --atags flag because the kernel sources for the PW3 (and all other Kindles?) do not include DTS/DTB files. Here's the commands that I used when attempting to load a different kernel (you can get the kernel boot commands from /proc/cmdline): Code:
./kexec \ -l /mnt/us/uImage \ --type uImage \ --atags \ #remove this for v2.0.3 --command-line="rootwait log_pos_goal=0x8fff0000 console=ttymxc0,115200 root=/dev/mmcblk0p1 ro ip=off debug ignore_loglevel video=mxcepdcfb:E60,bpp=8,x_mem=3M" ./kexec -e Spoiler:
I'm not sure how to go about debugging this further but in all honesty, I'm not that bothered - if all you want to do is add kernel features that are available at compile time only, the steps above should be enough to get you going. It goes without saying that it's a very good idea to have a serial cable attached when doing any of this - it's useful for keeping an eye on the things during boot and it'll make life easier when dealing with the inevitable bricks that you'll cause when messing around with fastboot and custom kernels. |
10-08-2020, 02:32 PM | #10 |
BLAM!
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Note that, for features you can enable as modules, the approach is much less destructive, as you don't actually need to flash a kernel, just push the modules to the device .
(I've used this myself on Kobo kernels to enable FUSE support, there are a few comments about it -- essentially similar to what you've just detailed -- in the x-compile.sh script in the x-tc tarballs of my snapshots). |
10-09-2020, 06:46 PM | #11 |
Connoisseur
Posts: 96
Karma: 100000
Join Date: Dec 2018
Location: London
Device: Kindle PW4, Libra H2O
|
For making modules, does one not just;
Code:
$ make $ make modules Last edited by trcm; 10-09-2020 at 06:48 PM. Reason: Clarify |
10-09-2020, 07:55 PM | #12 |
BLAM!
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Notice your "make" step? It means it requires the same hoop jumping necessary for the kernel to actually build in the first place .
|
08-05-2021, 07:34 AM | #13 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2021
Device: Kindle Paperwhite 2 & 4
|
Has anyone actually confirmed whether kexec has been disabled? How was it verified? I must have been blind to any information on that.
|
08-05-2021, 07:49 AM | #14 |
Junior Member
Posts: 2
Karma: 10
Join Date: Aug 2021
Device: Kindle Paperwhite 2 & 4
|
Nevermind, I should have checked myself.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Upgrading or kexec-ing newer kernel? | Yasen6275 | Kindle Developer's Corner | 6 | 04-02-2014 04:28 AM |
[K3] Custom Kernel (rescue shell !, kexec, patched recovery) | seaniko7 | Kindle Developer's Corner | 16 | 03-29-2014 05:13 PM |
Custom 3.3 kernel with kexec support and patched recovery | seaniko7 | Kindle Developer's Corner | 10 | 09-09-2012 04:14 PM |
PRS-T1 How-to: Compiling the kernel and kernel modules | altruizine | Sony Reader Dev Corner | 9 | 09-03-2012 09:12 PM |
iLiad iLiad kernel development | jayakumar | iRex Developer's Corner | 65 | 07-05-2010 04:00 AM |