10-11-2021, 06:36 PM | #1 |
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Swapping the 3G modem for a USB Flash Drive
Continuation of Swapping the 3G modem for a 4G modem, post 2 and Swapping the 3G modem for a 4G modem, post 3
I found and bought a mini-PCIe to USB adpater on Amazon with one-day shipping yesterday, and it arrived today. I've installed it in my Kindle Keyboard, inserted a FAT32 USB drive, and oops! No SCSI over USB support in the kernel! Which means "/dev/sda" and "/dev/sda1" (and so on) don't exist. As existence is a prerequisite of being mounted, I have to (I assume) build some kernel modules and place them in the appropriate directory in "/lib/modules/", specifically "USB_STORAGE" and "SCSI". Ugh. As I've never built a kernel module before (my experience with the Linux kernel is solely building the kernel after taking a config file from "/boot/", tweaking it, and naming it ".config", and running "make bindeb-pkg"), let alone cross-compile kernel modules, I'd like some advice. 1) Should I use the toolchain at Snapshots of NiLuJe's hacks? 2) Where would I get the kernel headers? 3) Do I download the source for the same version number as the output of "uname -r" (2.6.26-rt in my case) from kernel.org to get the module source? |
10-12-2021, 11:10 AM | #2 |
Guru
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
I'm at work so I couldn't spend a lot of time looking at this, but I found a link to how I compiled some kernel modules for mouse and keyboard support
https://www.mobileread.com/forums/sh...=277236&page=5 It's been a few years so I imagine some stuff has changed. But hopefully it gives you a starting point. I didn't ever look into getting the headers to load automatically. I had to do 'insmod' I think, and some people have made Kual plug-ins for the usb side if you look I to that thread Last edited by coplate; 10-12-2021 at 11:13 AM. |
Advert | |
|
10-12-2021, 05:15 PM | #3 |
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
The Amazon-provided source code for Kindle Keyboard ver. 3.4.3 doesn't include the linaro cross-compiler nor the kernel headers. Unless the headers archive is named something other than "khdrs.tar.gz"?
|
10-12-2021, 06:34 PM | #4 |
Guru
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
My notes were for paperwhite 2 and newer, so I'm not surprised. Just hoped it would help
|
10-13-2021, 08:50 AM | #5 | |
rm -rf /
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
|
Quote:
1) That would be the easiest way to get a vaguely compatible cross-compiler toolchain, I think that there's a specific one for older Kindles so I'd use that one 2) Headers are already present within the source tar ball 3) Use the linux-2.6.26-lab126.tar.bz2 tarball within the Kindle_src_3.4.3_3543620001.tar.gz sources. Building the kernel modules will be something along the lines of this: Code:
cd linux-2.6.26 # Note: you should change CROSS_COMPILE to the triplet of your toolchain make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- imx35_luigi_defconfig # I think this is the right defconfig? make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- menuconfig # Then select the kernel modules that you need make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- modules_prepare make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- M=drivers/usb/ -j7 # This will build all kernel modules within a specific directory, you'll need to do this for a few directories IIRC make ARCH=arm CROSS_COMPILE=arm-kindlepw2-linux-gnueabi- modules -j7 # Or just build all of them at once, wastes time because it'll build kernel modules that are already on the device find . -name *.ko # Get the paths of your shiny new kernel modules! You'll probably run into some really obscure build errors that will require patching, compiling legacy kernel versions with any vaguely modern cross-compiler is something of a dark art |
|
Advert | |
|
10-13-2021, 11:44 AM | #6 | |
BLAM!
Posts: 13,480
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Quote:
There are a bunch of comments about this in my x-compile script (mainly about Kobo kernels, but some of it might apply), right after the fuse build. |
|
10-14-2021, 01:17 AM | #7 | |||
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Quote:
Quote:
Code:
linux-2.6.26$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- imx35_luigi_defconfig Makefile:436: *** mixed implicit and normal rules: deprecated syntax Makefile:1556: *** mixed implicit and normal rules: deprecated syntax make: *** No rule to make target 'imx35_luigi_defconfig'. Stop. Code:
linux-2.6.26$ grep defconfig Makefile # used for 'make defconfig' boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig) board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig)) printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \ boards-per-dir = $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)) printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \ define all-defconfigs $(call find-sources,'defconfig') $(all-defconfigs) | xargs -r $1 -a \ $(all-defconfigs) | xargs -r $1 -a \ Code:
linux-2.6.26$ ls arch/arm/configs/imx35_luigi_defconfig arch/arm/configs/imx35_luigi_defconfig Code:
linux-2.6.26$ cp arch/arm/configs/imx35_luigi_defconfi g .config Code:
linux-2.6.26$ nano .config [ File '.config' is unwritable ] Code:
linux-2.6.26$ sudo nano .config [ Wrote 1557 lines ] Code:
linux-2.6.26$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_prepare Makefile:1556: *** mixed implicit and normal rules: deprecated syntax linux-2.6.26/Makefile:436: *** mixed implicit and normal rules: deprecated syntax linux-2.6.26/Makefile:1556: *** mixed implicit and normal rules: deprecated syntax make[1]: *** No rule to make target 'silentoldconfig'. Stop. make: *** No rule to make target 'modules_prepare'. Stop. Code:
linux-2.6.26$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules Makefile:1556: *** mixed implicit and normal rules: deprecated syntax linux-2.6.26/Makefile:436: *** mixed implicit and normal rules: deprecated syntax linux-2.6.26/Makefile:1556: *** mixed implicit and normal rules: deprecated syntax make[1]: *** No rule to make target 'silentoldconfig'. Stop. The present kernel configuration has modules disabled. Type 'make config' and enable loadable module support. Then build a kernel with module support enabled. make: *** [Makefile:1102: modules] Error 1 Code:
linux-2.6.26$ grep -i module .config CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_MODULES=y # CONFIG_MODULE_FORCE_LOAD is not set CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y # CONFIG_MODULE_SRCVERSION_ALL is not set # MXC MPEG4 Encoder Kernel module support Quote:
Can anyone help me get the modules built? |
|||
10-16-2021, 11:53 PM | #8 |
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Okay, I've managed to build the Kernel modules, but I get
Code:
insmod: error inserting '/mnt/us/usb-storage.ko': -1 Invalid module format I pulled the .config from Code:
/proc/config.gz |
10-17-2021, 07:41 AM | #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
|
Quote:
Quote:
You can fix this (in a hacky way) like so: Code:
diff --git a/Makefile b/Makefile index 3ed09d0d..232a7658 100644 --- a/Makefile +++ b/Makefile @@ -433,7 +433,11 @@ ifeq ($(config-targets),1) include $(srctree)/arch/$(SRCARCH)/Makefile export KBUILD_DEFCONFIG -config %config: scripts_basic outputmakefile FORCE +config: scripts_basic outputmakefile FORCE + $(Q)mkdir -p include/linux include/config + $(Q)$(MAKE) $(build)=scripts/kconfig $@ + +%config: scripts_basic outputmakefile FORCE $(Q)mkdir -p include/linux include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@ @@ -1553,7 +1557,11 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules -/ %/: prepare scripts FORCE +/: prepare scripts FORCE + $(cmd_crmodverdir) + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(build-dir) +%/: prepare scripts FORCE $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) Quote:
Code:
│ Symbol: USB_STORAGE [=n] │ │ Prompt: USB Mass Storage support │ │ Defined at drivers/usb/storage/Kconfig:9 │ │ Depends on: USB_SUPPORT && USB && SCSI │ │ Location: │ │ -> Device Drivers │ │ -> USB support (USB_SUPPORT [=y]) Quote:
|
||||
10-17-2021, 12:52 PM | #10 | ||||
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Quote:
Quote:
Quote:
Quote:
Code:
scsi_mod: no symbol version for struct_module Code:
linux-2.6.26/scripts/gen_initramfs_list.sh: Cannot open '../../initramfs/skeleton-luigi.list' |
||||
10-17-2021, 02:21 PM | #11 |
BLAM!
Posts: 13,480
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Oh, hey, didn't even remember I went through that very masochistic experience myself before ;p (re: the patch).
As for the initramfs stuff: Yeah, you need to build the full kernel because of CONFIG_MODVERSION or something or other (can't remember, wrote it down somewhere in x-compile, though ;p). You can safely disable the initramfs altogether for that very purpose in your kernel config (you won't be able to boot said kernel, obviously, but we don't care when the goal is building modules, not flashing kernels ). Last edited by NiLuJe; 10-17-2021 at 02:24 PM. |
10-17-2021, 03:27 PM | #12 |
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Disabled the initramfs and now the kernel build errors at
Code:
CC init/version.o LD init/built-in.o LD .tmp_vmlinux1 arch/arm/kernel/built-in.o: In function `sys_mmap2': io.c:(.text+0xc08): undefined reference to `do_mmap2' Makefile:778: recipe for target '.tmp_vmlinux1' failed make: *** [.tmp_vmlinux1] Error 1 I noticed I never said what toolchain I'm using now. I'm now using gcc-arm-linux-gnueabi from the default repositories for apt, as I made a new Ubuntu instance to have a clean slate to work with between posts #7 and #8. |
10-18-2021, 04:34 PM | #13 |
BLAM!
Posts: 13,480
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Possibly a symbol generated from a macro, which would make finding it via a simple grep harder .
This doesn't ring a bell, but, on the other hand, I don't recall ever building this stuff with anything else than the final Linaro GCC 4.9 release (e.g., start from the kindle koxtoolchain profile, and just switch to said GCC release in the menuconfig). And the Ubuntu TCs are generally Not Great (TM) for this stuff (... much like the distro itself. Oops ) . |
10-18-2021, 06:12 PM | #14 | |
Member
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
|
Quote:
Confession Time: This thread is the entirety of my documentation I've wrote for this process so far. Nothing was written down about why your toolchain didn't work. Oops? Aww man, you can't tell me Ubuntu and it's available toolchain is Not Great™ and leave me hanging on what distro family would be a better build environment! (It's never a good sign when one busts out the trademark for anything bad :P) |
|
10-19-2021, 10:36 AM | #15 |
the rook, bossing Never.
Posts: 11,472
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Gentoo users cook chickens by first hatching an egg. If it doesn't have a good tool chain?
But Ubuntu is based on Debian and I never heard of any common TC issue with Debian. I use Mint, but other than building Joyce (PCW8512/PCW9512) for Z80 emulator (needs CP/M too) on Mint, I've not fiddled with TCs on Linux since about 2008 and CentOS for x86 and Debian for ARM. Building Joyce needed a lot of extra installs. However, I'd rather buy a new Kobo or Kindle and use a phone as a 4G to WiFi hot spot than do this. I changed OpenWRT on x86 to use a prototype PCMCIA 4G modem and a custom prototype ARM with touch screen and Debian to use the same modem. Only part of the aerial bulge stuck out of the demo ARM pocket sized box. It was a lot of work, I had a linux guru helping and support & source from the 4G modem maker. Not LTE or Wimax, but a different now dead 4G. Wimax is also dead now. |
Tags |
expansion, hardware modding, modem, storage, usb mass storage |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
K3 Swapping the 3G modem for a 4G modem | wishindo | Kindle Developer's Corner | 5 | 07-27-2023 10:47 PM |
USB (flash drive) to iPad | yankgirl | Apple Devices | 11 | 07-17-2011 06:48 PM |
Does Kindle spread USB virus like USB flash drive? | rockchen | General Discussions | 49 | 02-17-2011 10:03 AM |
FBReader and USB Flash Drive | desertblues | iRex | 0 | 03-15-2010 09:37 AM |