View Single Post
Old 10-19-2021, 03:52 PM   #17
katadelos
rm -rf /
katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.katadelos ought to be getting tired of karma fortunes by now.
 
Posts: 219
Karma: 3333683
Join Date: Nov 2019
Location: United Kingdom
Device: K5, KT, KT2, KT3, KT4, KV, PW2, PW3, PW4, PW5
Quote:
Originally Posted by wishindo View Post
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 couldn't find anything conclusive about this online. Supposedly, the error means we tried to use a function that wass never coded, but io.c doesn't contain any instances of "do", "sys", or "mm" according to nano.
Had a look at this last night, this patch should fix your issue.

Code:
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 0128687b..b0daaab2 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -35,7 +35,7 @@ extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
                               unsigned long new_addr);
 
 /* common code for old and new mmaps */
-inline long do_mmap2(
+extern inline long do_mmap2(
        unsigned long addr, unsigned long len,
        unsigned long prot, unsigned long flags,
        unsigned long fd, unsigned long pgoff)
diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
index eb51d76e..04612394 100644
--- a/kernel/timeconst.pl
+++ b/kernel/timeconst.pl
@@ -370,7 +370,7 @@ if ($hz eq '--can') {
        }
 
        @val = @{$canned_values{$hz}};
-       if (!defined(@val)) {
+       if (!@val) {
                @val = compute_values($hz);
        }
        output($hz, @val);
Quote:
Originally Posted by wishindo View Post
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.
One reason why the default Ubuntu toolchains aren't great for this kind of thing is because of the specific glibc version requirements across the range of the devices. The Ubuntu ones aren't terrible for virt targets but for Kindle stuff, I use either the toolchains provided by NiLuJe or custom ones generated by an OpenWRT fork that I'm adapting for Kindle.

You can build the koxtoolchains on Ubuntu, you just need to make sure that you've got all of the dependencies installed:

Code:
# From this crosstools-ng dockerfile: https://github.com/crosstool-ng/crosstool-ng/blob/0528a9d744cc95aac3df40d5a1666f0a1051cf5d/testing/docker/ubuntu18.04/Dockerfile
apt-get install -y gcc g++ gperf bison flex texinfo help2man make libncurses5-dev \
    python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 xz-utils unzip \
    patch libstdc++6 rsync

# From the dependency list on the koxtoolchains repo:
sudo apt-get install build-essential autoconf automake bison flex gawk libtool libtool-bin libncurses-dev curl file git gperf help2man texinfo unzip wget
katadelos is offline   Reply With Quote