View Single Post
Old 09-12-2019, 08:42 PM   #1
schuhumi
Member
schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.schuhumi ought to be getting tired of karma fortunes by now.
 
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:
Bring the Kindle into bootloader mode by:
- Pressing the power button until power LED goes off.
- Keep on pressing power button and start pressing the "magic" key.
- Release power button while still pressing "magic" key.
- Release "magic" key.
what is the "magic key" (which seemingly was the home button on older models) on a PW3 which only has literally 1 button - the power one?

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 $@/
And can actually compile like this (which is pretty much amazing considering this was made for another kernel version):
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
But no built module to be found... But maybe that's because I don't quite grasp how it should build, and it doesn't do anything with that code from the repository.

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
schuhumi is offline   Reply With Quote