View Single Post
Old 10-14-2021, 01:17 AM   #7
wishindo
Member
wishindo began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Florida, USA
Device: Kindle Keyboard w/ 3G (k3g), Likebook Mars (T80D)
Quote:
Originally Posted by katadelos View Post
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
As that toolchain seems to need to be built on Gentoo, and I'm using Ubuntu 20.04 on WSL1 on Windows 10, I'll just use the toolchain in the Amazon Kindle 8th Gen source package as that builds just fine.

Quote:
Originally Posted by katadelos View Post
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!
Let's try that.

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.
So a defconfig build failed...

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 \
...but there are default configurations in "arch/arm/configs/". Let's look there.

Code:
linux-2.6.26$ ls arch/arm/configs/imx35_luigi_defconfig
arch/arm/configs/imx35_luigi_defconfig
A hit! A quick peek at it's contents indicate that this is a config file with stuff already set. Let's take it.

Code:
linux-2.6.26$ cp arch/arm/configs/imx35_luigi_defconfi
g .config
And edit it to add USB and SCSI support

Code:
linux-2.6.26$ nano .config
[ File '.config' is unwritable ]
sudo And edit it to add USB and SCSI support

Code:
linux-2.6.26$ sudo nano .config
[ Wrote 1557 lines ]
Build time?

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.
Uh, is that a necessary step though? Let's try ignoring that.

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
Weird default but okay.

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
But you said "The present kernel configuration has modules disabled" earlier!

Quote:
Originally Posted by katadelos View Post
You'll probably run into some really obscure build errors that will require patching
I think you jinxed it.

Can anyone help me get the modules built?
wishindo is offline   Reply With Quote