anbox / anbox-modules

Anbox kernel modules
327 stars 224 forks source link

Solution for building binder and ashmem modules on kernel version above 5.7 #75

Open SoulInfernoDE opened 3 years ago

SoulInfernoDE commented 3 years ago

Hello, here are the log:

ASHMEM

DKMS make.log for anbox-ashmem-1 for kernel 5.11.0-051100-generic (x86_64) Sa 27. Feb 08:00:47 CET 2021 make -C /lib/modules/5.11.0-051100-generic/build V=0 M=$PWD make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-051100-generic“ wird betreten CC [M] /var/lib/dkms/anbox-ashmem/1/build/deps.o CC [M] /var/lib/dkms/anbox-ashmem/1/build/ashmem.o LD [M] /var/lib/dkms/anbox-ashmem/1/build/ashmem_linux.o MODPOST /var/lib/dkms/anbox-ashmem/1/build/Module.symvers ERROR: modpost: "kallsyms_lookup_name" [/var/lib/dkms/anbox-ashmem/1/build/ashmem_linux.ko] undefined! make[2]: *** [scripts/Makefile.modpost:111: /var/lib/dkms/anbox-ashmem/1/build/Module.symvers] Fehler 1 make[2]: *** Datei „/var/lib/dkms/anbox-ashmem/1/build/Module.symvers“ wird gelöscht make[1]: *** [Makefile:1710: modules] Fehler 2 make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-051100-generic“ wird verlassen make: *** [Makefile:12: all] Fehler 2

BINDER

DKMS make.log for anbox-binder-1 for kernel 5.11.0-051100-generic (x86_64) Sa 27. Feb 08:00:50 CET 2021 make -C /lib/modules/5.11.0-051100-generic/build V=0 M=$PWD make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-051100-generic“ wird betreten CC [M] /var/lib/dkms/anbox-binder/1/build/deps.o CC [M] /var/lib/dkms/anbox-binder/1/build/binder.o /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_get_unused_fd_flags’: /var/lib/dkms/anbox-binder/1/build/binder.c:444:9: error: implicit declaration of function ‘__alloc_fd’ [-Werror=implicit-function-declaration] 444 | return __alloc_fd(files, 0, rlim_cur, flags); | ^~~~~~~~~~ /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_fd_install’: /var/lib/dkms/anbox-binder/1/build/binder.c:454:3: error: implicit declaration of function ‘__fd_install’; did you mean ‘fd_install’? [-Werror=implicit-function-declaration] 454 | __fd_install(proc->files, fd, file); | ^~~~~~~~~~~~ | fd_install /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘task_close_fd’: /var/lib/dkms/anbox-binder/1/build/binder.c:467:11: error: implicit declaration of function ‘__close_fd’; did you mean ‘close_fd’? [-Werror=implicit-function-declaration] 467 | retval = __close_fd(proc->files, fd); | ^~~~~~~~~~ | close_fd /var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_mmap’: /var/lib/dkms/anbox-binder/1/build/binder.c:3498:16: error: implicit declaration of function ‘get_files_struct’; did you mean ‘put_files_struct’? [-Werror=implicit-function-declaration] 3498 | proc->files = get_files_struct(current); | ^~~~~~~~~~~~~~~~ | put_files_struct cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:279: /var/lib/dkms/anbox-binder/1/build/binder.o] Fehler 1 make[1]: *** [Makefile:1806: /var/lib/dkms/anbox-binder/1/build] Fehler 2 make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-051100-generic“ wird verlassen make: *** [Makefile:8: all] Fehler 2

rizzini commented 3 years ago

Same here.

choff commented 3 years ago

Hello all,

I just came across the same problem. After some research on this topic, I found out that the build fails because "kallsyms_lookup_name()" is now no longer exported by the kernel for reasons described here: https://lwn.net/Articles/813350 . However, Anbox kernel modules are using kallsyms_lookup_name() to access some internal kernel functions that they otherwise wouldn't be able to call (such as "zap_page_range"). The Anbox kernel modules should never have used these functions in the first place as they are not supposed to be used by kernel modules (they are lacking an "EXPORT_SYMBOL()" annotation).

There is probably nothing that we can do to get these kernel modules to compile for kernels 5.10 and 5.11 anymore. To solve the problems, changes to the upstream kernel would be required to export the (up to now) internal functions like "zap_page_range()" and add an EXPORT_SYMBOL annotation to them.

You are probably best off by asking the kernel maintainers of your Linux distribution to include binder and ashmem in their kernels per default. The way it looks right now, building ashmen and binder as kernel modules is no longer a way to go. To make it work again, the Linux kernel devs would need to expose a whole lot of up-to-now internal functions - I am not sure if even they's be willing to do that.

Best regards,

Christian

choff commented 3 years ago

Essentially, this is a duplicate of issue #49 , though the error message you see is slightly different. Please check my last commit in that issue if you really need a solution that makes binder and ashmem work again as modules with the latest kernels. I am using it with kernel 5.10 and it works fine.

SoulInfernoDE commented 3 years ago

So okay im writing down how i am trying to fix the issue for me. (12.03.21 - i reviewed the procedure after some testing.)

New edit: successfully compiled and tested! - [13.03.21]


Compile kernel with android options enabled:

-->> Scripts for automate the following steps can be obtained and improved here: https://github.com/SoulInfernoDE/compile-kernel-from-source

.

[28.03.23] ### For the lazy ones a modern one liner for copy and paste to your terminal for the first use:

rm cfs_noguimerge.sh*; wget https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/v6.x/nogui/cfs_noguimerge.sh && chmod +x cfs_noguimerge.sh && ./cfs_noguimerge.sh

.

### For the second use you need to delete all files generated by the script / tool to work correctly again:

rm cfs_noguimerge.sh*; sudo rm -f ~/Downloads/linux-*.deb ~/Downloads/linux-*.buildinfo ~/Downloads/linux-*.changes ~/Downloads/ashmemk6.tar.xz*; sudo rm -R -f ~/Downloads/kernel/ ~/Downloads/anboxashmem/; wget https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/v6.x/nogui/cfs_noguimerge.sh && chmod +x cfs_noguimerge.sh && ./cfs_noguimerge.sh

.

i am using Linux Mint 21.1 with Kernel 6.1.12 from UKUU utility which downloads and installs the kernels from official source. (you can always manually download and install them on http://kernel.ubuntu.com/~kernel-ppa/mainline/ but ukuu automates that with a nice gui - its not for free so manually installing them is the recommend way for most ppl.)


Steps to manually compile your kernel with ANDROID options:

Show your current installed kernel: uname -a Linux 5.11.6-051106-generic #202103111435 SMP Thu Mar 11 14:42:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Installing propably needed dependencies: Installing propably needed dependencies:

sudo apt install git dwarves build-essential fakeroot bc kmod cpio libncurses5-dev libgtk2.0-dev libglib2.0-dev libglade2-dev libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev dpkg-dev autoconf libdw-dev cmake zstd

download and install dependency dwarves: (deprecated since newer linux versions already include this) http://archive.ubuntu.com/ubuntu/pool/universe/d/dwarves-dfsg/dwarves_1.21-0ubuntu1~20.04_amd64.deb http://archive.ubuntu.com/ubuntu/pool/universe/d/dwarves-dfsg/dwarves_1.17-1_amd64.deb http://archive.ubuntu.com/ubuntu/pool/universe/d/dwarves-dfsg/dwarves_1.20-1_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/libb/libbpf/libbpf0_0.3-2ubuntu1_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/g/glibc/libc6_2.33-0ubuntu5_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/g/glibc/libc6_2.33-0ubuntu5_i386.deb http://mirrors.kernel.org/ubuntu/pool/main/f/fakeroot/libfakeroot_1.25.3-1.1ubuntu2_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/f/fakeroot/fakeroot_1.25.3-1.1ubuntu2_amd64.deb http://mirrors.kernel.org/ubuntu/pool/main/g/glibc/locales_2.33-0ubuntu5_all.deb http://mirrors.kernel.org/ubuntu/pool/main/g/glibc/libc-bin_2.33-0ubuntu5_amd64.deb

Edit new [12.07.2021]: The newest stable kernel 5.13.1 doesn't compile with the pahole/dwarves version 1.17 anymore. To fix this i downloaded the source of pahole v1.21, compiled and installed it:

git clone https://github.com/acmel/dwarves.git cd dwarves mkdir build cd build sudo cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF .. sudo make install

I downloaded official kernel source from here: https://www.kernel.org https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.4/ with following command:

Create a folder where we download the source code, create the compile-configuration parameter file and finally compile the kernel with it:

mkdir kernel wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.18.tar.xz tar xvf linux-* -C kernel/ --strip-components=1 cd kernel git clone git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack cod/mainline/v5.11.4 cd cod/mainline/v5.11.4

Information::: You need to have the latest kernel running to copy the correct config file of your current running kernel!

I copied the original .config file for building the kernel from my installed one: cp /boot/config-$(uname -r) ./.config


KERNEL 5.18.X and above ASHMEM has been dropped completely as to this kernel source patch from torvalds: https://github.com/torvalds/linux/commit/721412ed3d819e767cac2b06646bf03aa158aaec

Aslong as anbox is using ASHMEM instead of MEMFD we need to revert the deletion of the ASHMEM module patch to be able to use anbox for now. Download the patch in the same directory you downloaded and extracted the kernel sources: wget -O remove_ashmem.patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=721412ed3d819e767cac2b06646bf03aa158aaec

Revert the patch with: interdiff -q remove_ashmem.patch /dev/null > enable_ashmem.patch

Patch the source code with the reverted patch code: patch -p1 -i enable_ashmem.patch

Proceed with the next steps described here - the ASHMEM is now back in the make xconfig


afterwards executing:

make xconfig or make gconfig

or if you build from an already enabled android options enabled kernel make an oldconfig with

make olddefconfig

scroll through the menu and look for ashmem and binder. (One is inside stageing driver if i remember correct.) grafik

Scroll further down to the next Android section: grafik

Double click to activate the marked points and save as you are ready.

If you start compiling now, there seems to be a bug at least at my side and it stops building with a 'debian/canonical-certs.pem' error.

To fix this you can create this file. Use the certificate data here in this patch: https://lists.ubuntu.com/archives/kernel-team/2020-October/113929.html

Copy from --BEGIN CERTIFICATE-- to --END CERTIFICATE--

and remove the '+' on each line.

Save it to debian/canonical-certs.pem

To fix the certificate error while compiling you need to remove path data in " " the line:

CONFIG_SYSTEM_TRUSTED_KEYS="" and CONFIG_SYSTEM_REVOCATION_KEYS=""

Start compile with a simple: time nice make bindeb-pkg LOCALVERSION=-android

If you want to compile with more cores run the command nproc and then you see your availabe cores. Run with number of cores you want to use -jX: time nice make -j4 bindeb-pkg LOCALVERSION=-android

Note: The time command counts how long the build process have taken after it finished.

Then install the deb packages which should be in your parent directory

cd .. sudo dpkg -i linux-*.deb

Restart and enter:

uname -a

it should print something like *android-1 then you know it booted the newly generated kernel.

Warning: Doing so needs some space and much time to build. I am still building... ...i will get back and report if it worked for me.

Edit 13.03.21: Successfully compiled the kernel with older 4 core-laptop in about 3 hours. After compiling try to follow the instructions to activate binderfs and activate /dev/binder permanent on boot. uname -a says:

Linux 5.11.6android1 #1 SMP Fri Mar 12 11:32:19 CET 2021 x86_64 x86_64 x86_64 GNU/Linux

Edit: Link to GDrive where i layed down my compiled deb-files for own history. (Using it in your own environment at your own risk!)

Pre-compiled *.debs:
**5.11.x Branch** - [x] Added updated kernel version 5.11.16 stable branch from kernel.org (26.04.21) **5.12.x Branch** - [x] Added updated kernel version 5.12.0 stable branch from kernel.org (27.04.21) - [x] Added updated kernel version 5.12.1 stable branch from kernel.org (05.05.21) - [x] Added updated kernel version 5.12.7 stable branch from kernel.org (27.05.21) - [x] Added updated kernel version 5.12.9 stable branch from kernel.org (06.06.21) - [x] Added updated kernel version 5.12.13 stable branch from kernel.org (30.06.21) - [x] Added updated kernel version 5.12.14 stable branch from kernel.org (03.07.21) **5.13.x Branch** - [x] Added updated kernel version 5.13.1 stable branch from kernel.org (09.07.21) (deprecated build) - [x] Added updated kernel version 5.13.8 stable branch from kernel.org (07.08.21) (deprecated build) - [ ] Added updated kernel version 5.13.9 stable branch from kernel.org (08.08.21) - (build succeeds but its not booting for me. Need to optimize dependencys for building with newer GCC and glibc first. I'll think of a build environment with newer ubuntu core as this has higher package versions already included. Next compile will take longer for me to figure out as i am busy also with real life.) - [x] Added updated kernel version 5.13.19 stable branch from kernel.org (compiled - uploaded on 12.01.22) **5.14.x Branch** - [x] Added updated kernel version 5.14.1 stable/upstream branch from kernel.org (08.09.21) - [x] Added updated kernel version 5.14.2 stable/upstream branch from kernel.org (09.09.21) - [x] Added updated kernel version 5.14.13 stable/upstream branch from kernel.org (17.10.21) - [x] Added updated kernel version 5.14.14 stable/upstream branch from kernel.org (22.10.21) _If your linux mint `cinnamon-settings` manager or similiar included system tools are not opening, then you need to install the imtools with: `pip3 install imtools` . Some updates changed the system behaviour. If you get a warning about an old pip version just execute: `/usr/bin/python3 -m pip install --upgrade pip`. Hope this helps._ - [x] Added updated kernel version 5.14.18 stable/upstream branch from kernel.org (14.11.21) - [x] Added updated kernel version [5.14.21](https://drive.google.com/drive/folders/1E__8VzscruPunzIWr8T88qfTQOpTWpYB) stable/upstream branch from kernel.org (24.11.21) [EOL] **5.15.x Branch** - [x] Added updated kernel version 5.15.5 stable/upstream branch from kernel.org (29.11.21) - [x] Added updated kernel version 5.15.6 stable/upstream branch from kernel.org (compiled on 07.12.21) - [x] Added updated kernel version [5.15.10](https://drive.google.com/drive/folders/1rxxwQfSoRKghSEtifZDU60YzdoG66W8X) stable/upstream branch from kernel.org (compiled on 20.12.21) - [x] Added updated kernel version [5.15.11](https://drive.google.com/drive/folders/1qHU0RrjyXzKMa_r_UHb_kCIbRnfA0EXc) stable/upstream branch from kernel.org (compiled on 25.12.21) **5.16.x Branch[EOL]** - [x] Added updated kernel version [5.16.20](https://drive.google.com/drive/folders/1LLsbJjU7jBXQQ9jIGtNTuOcD2OWsNpXI) stable/upstream branch from kernel.org (16.04.22) **5.17.x Branch** - [x] Added updated kernel version [5.17.1](https://drive.google.com/drive/folders/1r_AQJpXbusoN4UiTSVL_DHIBPeTb0Qk3) stable/upstream branch from kernel.org (05.04.22) - [x] Added updated kernel version [5.17.2](https://drive.google.com/drive/folders/1QpslfT6XLL2njkT01ef_RcXcMuGfUQTg) stable/upstream branch from kernel.org (11.04.22) - [x] Added updated kernel version [5.17.3](https://drive.google.com/drive/folders/11Y1LgM78ywSYWpINvEqMP8lJU-Fb_oLi) stable/upstream branch from kernel.org (16.04.22) - [x] Added updated kernel version [5.17.5](https://drive.google.com/drive/folders/1TakXT93Q16s_Sz7zOcmAZ7L4xvMy8WEC) stable/upstream branch from kernel.org (01.05.22) - [x] Added updated kernel version [5.17.6](https://drive.google.com/drive/folders/1o1Nbhmiyxqz6j0iRdkPfI2wxnFcPX6z6) stable/upstream branch from kernel.org (11.05.22) - [x] Added updated kernel version [5.17.9](https://drive.google.com/drive/folders/1r0sCpvXVDTLoSrzxpzKjgcAFGGh1oB8W) stable/upstream branch from kernel.org (19.05.22) - [x] Added updated kernel version [5.17.11](https://drive.google.com/drive/folders/1JUHGSU9YuWN__OB3ojQN7qosQDVR3lms) stable/upstream branch from kernel.org (28.05.22) - [x] Added updated kernel version [5.17.15 EOL](https://drive.google.com/drive/folders/1S7dQS_Ak_U0-mgybR5kVphBRYDFxchn4) stable/upstream branch from kernel.org (18.06.22) **5.18.x Branch - EOL** - [x] Added updated kernel version [5.18](https://drive.google.com/drive/folders/1kRde57LjFbD0FXHTeZUsjyvhdjhnI3GW) stable/main branch from kernel.org (29.05.22) - [x] Added updated kernel version [5.18.5](https://drive.google.com/drive/folders/11OYGGzXmOUFxWt7CjKH5mlwcdYa19SRl) stable/main branch from kernel.org (18.06.22) - [x] Added updated kernel version [5.18.7](https://drive.google.com/drive/folders/1N_YkARpFzeEHfhMK0WgN0MSV1mrdXHlf) stable/main branch from kernel.org (25.06.22) - [x] Added updated kernel version [5.18.9](https://drive.google.com/drive/folders/1BNuNI0L6n8uvacIFmWGHnpT_shNZUP6V) stable/main branch from kernel.org (03.07.22) - [x] Added updated kernel version [5.18.10](https://drive.google.com/drive/folders/15mqK_razgkTNDCsgjNfbtFh34eW8Pr9x) stable/main branch from kernel.org (10.07.22) - [x] Added updated kernel version [5.18.12](https://drive.google.com/drive/folders/1v40J9TLyhLNFS3ELpV7OeJeM9zKiF-4s) stable/main branch from kernel.org (21.07.22) - [x] Added updated kernel version [5.18.19 - EOL](https://drive.google.com/drive/folders/1XSazvmMJclXQ2viZUVATWDAGXOEc2MWx) stable/main branch from kernel.org (10.09.22) **5.19.x Branch** - [x] Added updated kernel version [5.19.8](https://drive.google.com/drive/folders/1MrIMiI-mrkgXHlY6rWLS-IlVX8MgOnsA) stable/main branch from kernel.org (11.09.22) - [x] Added updated kernel version [5.19.10](https://drive.google.com/drive/folders/1bmm2AAAfFf60SZif1GN8iSBwqKQGtjcL) stable/main branch from kernel.org (21.09.22)

6.x Branch

NOTE: DUE TO LIMITED TIME FOR THESE THINGS I AM NOT GOING TO UPDATE THE LIST FREQUENTLY. I WILL UPDATE THE GDRIVE FOLDER FROM TIME TO TIME WITHOUT NOTICE HERE

´ ´

WARNING! In 5.18.x ASHMEM has been completely removed from the kernel according to this commit from torvalds: https://github.com/torvalds/linux/commit/721412ed3d819e767cac2b06646bf03aa158aaec I am investigating how i can work around that problem actually.. ..for now use 5.17.x we need to revert that patch until anbox uses MEMFD instead of ASHMEM to be able to use anbox again.

- Future plan is to compile some kernel branches with the latest / last EOL kernel for other use cases and clean/remove old/deprecated ones.


Note as of now: (09.07.21)

To be able to successfully build and run the latest kernel versions with linux mint 20.x you need newer glibc and gcc versions which are included in ubuntu 21.10 already. Unfortunately i didn't figure out yet how i could update them without "heart touching" the whole linux mint 20.x system. It is until now very complicated as you need to compile gcc and glibc from source and maybe many other dependencys that relay on other updated dependencys and updated gcc and glibc. So for me until now i workaround this with a virtual machine (i use a synology virtual machine which works independend of my laptop. You may could use QEMU for example if you really want to build from scratch) and the latest ubuntu 21.04 installation where i use this handbook i wrote together to build the newer kernels there until linux mint switches to the new ubuntu base image where many apps and dependencys will get updates and higher versions included. I know this is very uncomfortable actually but in my opinion more stressless. Maybe i'll try docker anytime in the future to build it in the future where we could create a preconfigured ubuntu image with dependencys already installed but thats on another star yet. If you need any option enabled in the kernel i can do that for my own pre-compiled kernels also, just leave a note here what you need. I dont care about some more drivers or options included even if i don't use them.

So if you want to compile newer kernels i'll suggest to stick to older ones actually or maybe to the 5.12.x branch where compiling could be done with the included files and apps from linux mint 20.x system.


Secure Boot / UEFI: (05.04.22) Using newer hardware with UEFI / Secure Boot active will need an extra step to make the changed android kernel builds boot. I recommend to take a look at this Information: (Thanks to jakeday to write down the steps for the average user like me) https://github.com/jakeday/linux-surface/blob/3267e4ea1f318bb9716d6742d79162de8277dea2/SIGNING.md

.

28.03.23: You can also have a look at this script / tool which automates the secure boot / uefi signing process ( a standard mok file is generated with dummy informations used in the certificate and signed with your newly generated kernel)

/v6.x/signkernel/cfs_signkernel.sh

.

### And for the lazy ones that want to copy and paste into a terminal:

rm cfs_signkernel.sh*; wget https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/v6.x/signkernel/cfs_signkernel.sh && chmod +x cfs_signkernel.sh && ./cfs_signkernel.sh

.

SoulInfernoDE commented 3 years ago

Hello all, i tried to compile the kernel like mentioned before but its more trial and error and guessing. I try to learn and understood linux and all the compiling things but im quietly new to this.

It did compile and install but it did not install the modules and therefore i couldn't boot into the system. Also it said it compiled 5.10 instead 5.11. Anyone wants to provide help to this topic as the best way seems to be to enable the in built modules as for now.

And the new ubuntu kernels seems to not have them enabled by default (v.5.11;v5.10 etc.)

choff commented 3 years ago

Hello @SoulInfernoDE ,

first of all, as soon as you build something into the kernel, it's not a module anymore. Modules are just dynamically loadable "plugins" for the kernel. So, if you have compiled ashmem and binder support into your kernel, ashmem and binder are not modules. They are just part of the main kernel.

What is the error message you see from Anbox? Is it complaining that either ashmem or binder kernel module is not loaded? Maybe in that case, it will help to upgrade Anbox... Maybe Anbox some time ago only supported the external kernel modules and not yet the built-in ashmem and binder functionality that is now available with recent kernels.

You should try to check the kernel config of your hand-compiled kernel with one of the methods described here: https://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system and verify that ashmem and binder are indeed enabled.

Do at least my "hacked" kernel modules for ashmem and binder work for you? Best regards,

Christian

SoulInfernoDE commented 3 years ago

Hello Christian, thanks for assisting. I am actually not at home to test your method. What I can say is that if I try to mount binder it says unknown file system. So I am sure my kernel don't know binder yet and if I look at the configuration file .config it is not active yet. Therefore the inbuilt ashmem and binder hasn't been compiled into the kernel yet.

Also the copied config from actual kernel says: ANDROID not configured

Which make menuconfig confirms this

choff commented 3 years ago

Hello @SoulInfernoDE ,

all right, then you know the root cause at the very least :-)

I think you are using some Ubuntu-based distributon. Ubuntu applies its own patches to the kernel and building a kernel for Ubuntu is described here: https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel . This description also tells you how you can modify the kernel configuration.

If you use a standard kernel without Ubuntu modifications, a simple "make menuconfig" will do the trick. But Ubuntu kernels are built in a different way and different commands need to be used there, so a "make menuconfig" will likely not work and you need to follow the instructions from the Ubuntu page that I have linked above.

Best regards,

Christian

SoulInfernoDE commented 3 years ago

Hello Christian, thanks for trying to support. It's the same article I mentioned under installing dependencies :-)

I have found this guide and will check that when I'm back home:

https://tutorialforlinux.com/2021/01/15/how-to-install-kernel-5-11-from-source-on-linux-mint-20/

WARNING: unfortunately this guide site has many ads. Still noted because it could help us.

Edit:

Also found this video guide: https://youtu.be/E4yRcmQqvWM

13.03.21 - I collected informations and successfully tested and compiled the kernel with the android options enabled.

You can read the solution here if you want to try it yourself and dont know how yet: https://github.com/anbox/anbox-modules/issues/75#issuecomment-794079944

Edit: 18.03.21

Successfully build 5.11.7

real    163m8,412s
user    553m7,071s
sys 54m21,928s
lsahn-gh commented 3 years ago

@SoulInfernoDE aren't the configs, ASHMEM/BINDER depended on ANDROID as platform dependency? so that you enable the dependency in force?

here is menuconfig help for ashmem

Depends on: STAGING [=n] && ANDROID [=n] && SHMEM [=n]

Edited Just figured out that I can manually pick the dependency :)

adil192 commented 3 years ago

Small update for anyone who comes across this thread...

sudo apt install git dwarves build-essential fakeroot bc kmod kernel-package cpio libncurses5-dev libgtk2.0-dev libglib2.0-dev libglade2-dev libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev dpkg-dev autoconf libdw-dev cmake

For me there was no kernel-package, and I was missing zstd. So the updated command can be sudo apt install git dwarves build-essential fakeroot bc kmod cpio libncurses5-dev libgtk2.0-dev libglib2.0-dev libglade2-dev libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev dpkg-dev autoconf libdw-dev cmake zstd

To fix the certificate error while compiling you need to remove path data in " " the line:

CONFIG_SYSTEM_TRUSTED_KEYS=""

I needed to remove the path from both trusted keys and revocation keys in my .config file:

CONFIG_SYSTEM_TRUSTED_KEYS=""
...
CONFIG_SYSTEM_REVOCATION_KEYS=""
SoulInfernoDE commented 2 years ago

I added that info and updated my notes. Thanks @adil192 :heart_decoration:

SeremTitus commented 2 years ago

I been having hard time trying to build and install this kernel modules, this issues' comment seem to have a solution however not being an expert in the Linux kernel am lost in the technicalities. Can some one help me out by linking a script that just works...I am on Ubuntu

SoulInfernoDE commented 2 years ago

i can try to make a script for you. You can also use my precompiled .deb files if you like:

https://drive.google.com/drive/folders/1X4ojO2KYExc94yc5XFlPx7M_tKu-5gBy?usp=sharing

Kernel 5.17.5 direct link: https://drive.google.com/drive/folders/1TakXT93Q16s_Sz7zOcmAZ7L4xvMy8WEC

Instructions for the deb files:

Reboot and open terminal: uname -a

If you see something like this: image

Then you have the modules built in and loaded..

What you need to do now is to activate the binder to make anbox work:

https://github.com/anbox/anbox-modules/issues/49#issuecomment-798691676 and https://github.com/anbox/anbox-modules/issues/50#issuecomment-807979822.

For the one shot script i will try to write it now.

Edit:

Creating the scripts is ongoing - the goal is a one shot nogui version and a gui version where you can manually add/change options. As i am doing all this in my spare time i will update and improve it from time to time.

You can find the scripts here: https://github.com/SoulInfernoDE/compile-kernel-from-source

SeremTitus commented 2 years ago

https://github.com/anbox/anbox-modules/issues/75#issuecomment-1118028687, took care of this issue for me.

Thanks to @SoulInfernoDE for help . And can you consider creating pull request

SoulInfernoDE commented 2 years ago

#75 (comment), took care of this issue for me.

Thanks to @SoulInfernoDE for help . And can you consider creating pull request

Sure, pull request is opened to your fork. If you have any ideas or suggestions feel free to contribute and pull request them back to my main branch.

jiujiu12321 commented 2 years ago

#75 (comment), took care of this issue for me. Thanks to @SoulInfernoDE for help . And can you consider creating pull request

Sure, pull request is opened to your fork. If you have any ideas or suggestions feel free to contribute and pull request them back to my main branch.

Can you advise the Linux kernel to support ashmem and binder in the kernel? Is there any email

SoulInfernoDE commented 2 years ago

Unfortunately everything about the linux kernel is going through their respective kernel maintainers mailing lists. The binder and ashmem was already in staging branch in the kernel but now they decided to drop ashmem completely. Therefor i think we won't see getting ashmem back and official as the successor to ashmem is memfd which is not used by anbox. Every decision that is taken for the kernel development is well considered in security and code flow that is based on what linus wants to have in his kernel. As for now as from a user perspective the only solution for us users is the solution i wrote here: https://github.com/anbox/anbox-modules/issues/75#issuecomment-794079944

If you need any help in getting it work, try to follow my write up and/or use my scripts to compile your kernel from source. If it's not working or you ran into issues feel free to write here and i try to assist you as far as i can.

best regards SI

jiujiu12321 commented 2 years ago

Unfortunately everything about the linux kernel is going through their respective kernel maintainers mailing lists. The binder and ashmem was already in staging branch in the kernel but now they decided to drop ashmem completely. Therefor i think we won't see getting ashmem back and official as the successor to ashmem is memfd which is not used by anbox. Every decision that is taken for the kernel development is well considered in security and code flow that is based on what linus wants to have in his kernel. As for now as from a user perspective the only solution for us users is the solution i wrote here: #75 (comment)

If you need any help in getting it work, try to follow my write up and/or use my scripts to compile your kernel from source. If it's not working or you ran into issues feel free to write here and i try to assist you as far as i can.

best regards SI

Downloading directly from the kernel website is too slow. I don't know how to use this tool for downloading the kernel source code in advance?

Thank you!

SoulInfernoDE commented 2 years ago

@jiujiu12321 I have modified the the script to download the source from a chinese mirror. I guess this will be faster for you. You can download the script here:

(right click and save-as. Then right click on the saved file and go to properties. Choose "Can be executed". Double click and click on open in terminal. enter your password when asked to install dependencies. Report any error and i try to fix them if there comes any up.. Thank you cfs_no_gui_beijing_mirror.sh

DeafMan1983 commented 2 years ago

Hello @SoulInfernoDE, my latest version kernel 5.15.x and I use Ubuntu 22.04 image

Is it possible for valid script for download kernel source and building make automat?

But I am scared if I build wrong then kernel will unusable. That is why I don't have high experience. But I have experience for simple game and application development. but not kernel module.

Thanks for understanding me!

Kind regards, Jens

SoulInfernoDE commented 2 years ago

I made this script for automation as I compile my kernels often from source and made the steps easier for me:

https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/main/nogui/cfs_noguimerge.sh

You will be asked to enter the version number you want to compile from source. In your case you can enter: 5.15.0 If it throws any errors, then feel free to report here. You cannot do much wrong as in linux you can install many and multiple kernels at the same time. You can select the one you want to boot after a restart of your computer. If one fails to boot for any reason you just restart and select your generic kernel to boot.

DeafMan1983 commented 2 years ago

Oh ... I have much errors :(

$ ./cfs_noguimerge.sh
Kernel Pull Merge Script v0.1a
Installing dependencies
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
autoconf is already the newest version (2.71-2).
bc is already the newest version (1.07.1-3build1).
bison is already the newest version (2:3.8.2+dfsg-1build1).
build-essential is already the newest version (12.9ubuntu3).
cmake is already the newest version (3.22.1-1ubuntu1).
cpio is already the newest version (2.13+dfsg-7).
dkms is already the newest version (2.8.7-2ubuntu2).
fakeroot is already the newest version (1.28-1ubuntu1).
flex is already the newest version (2.6.4-8build2).
gawk is already the newest version (1:5.1.0-1build3).
kmod is already the newest version (29-1ubuntu1).
libdw-dev is already the newest version (0.186-1build1).
libelf-dev is already the newest version (0.186-1build1).
libglib2.0-dev is already the newest version (2.72.1-1).
libiberty-dev is already the newest version (20211102-1build1).
libncurses-dev is already the newest version (6.3-2).
libncurses5-dev is already the newest version (6.3-2).
libpci-dev is already the newest version (1:3.7.0-6).
libxi-dev is already the newest version (2:1.8-1build1).
nano is already the newest version (6.2-1).
packagekit is already the newest version (1.2.5-2ubuntu2).
zstd is already the newest version (1.4.8+dfsg-3build1).
dwarves is already the newest version (1.22-8).
libglade2-dev is already the newest version (1:2.6.4-2.4).
libgtk2.0-dev is already the newest version (2.24.33-2ubuntu2).
libpackagekitqt5-dev is already the newest version (1.0.2-1).
qt5ct is already the newest version (1.5-1build1).
dpkg-dev is already the newest version (1.21.1ubuntu2.1).
git is already the newest version (1:2.34.1-1ubuntu1.2).
libssl-dev is already the newest version (3.0.2-0ubuntu1.5).
openssl is already the newest version (3.0.2-0ubuntu1.5).
libudev-dev is already the newest version (249.11-0ubuntu3.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mkdir: cannot create directory ‘kernel’: File exists
Which kernel version do you want to compile? (example: 5.18.1) 5.15.0-40
kernel version you entered: 5.15.0-40_android
--2022-06-25 14:48:03--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.0-40.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:6f::432, 199.232.189.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:6f::432|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-06-25 14:48:03 ERROR 404: Not Found.

tar: linux-*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Downloading the ASHMEM source code removal patch from upstream
--2022-06-25 14:48:03--  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=721412ed3d819e767cac2b06646bf03aa158aaec
Resolving git.kernel.org (git.kernel.org)... 2604:1380:4601:e00::1, 145.40.68.75
Connecting to git.kernel.org (git.kernel.org)|2604:1380:4601:e00::1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘remove_ashmem.patch’

remove_ashmem.p     [ <=>  ]  32,04K  --.-KB/s    in 0,02s   

2022-06-25 14:48:03 (1,33 MB/s) - ‘remove_ashmem.patch’ saved [32814]

Reverting the removal patch code..
./cfs_noguimerge.sh: line 24: interdiff: command not found

Patching the kernel sources to bring back ASHMEM..

DONE! ASHMEM is now selectable again in your kernel .config file! NOTE: THIS MAY BREAK ANYTIME AS ASHMEM IS REPLACED WITH MEMFD
which is not supported by Anbox yet..
make: *** No rule to make target 'olddefconfig'.  Stop.
Configuration file with standard defaults options: 5.15.0-40_android has been created..
--2022-06-25 14:48:03--  https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/main/nogui/.config-fragment
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8002::154, 2606:50c0:8001::154, 2606:50c0:8003::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8002::154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 302 [text/plain]
Saving to: ‘.config-fragment.2’

.config-fragmen 100%[=====>]     302  --.-KB/s    in 0s      

2022-06-25 14:48:03 (13,0 MB/s) - ‘.config-fragment.2’ saved [302/302]

./cfs_noguimerge.sh: line 37: ./scripts/kconfig/merge_config.sh: No such file or directory
merging new android options into the .config file:
make: *** No rule to make target 'olddefconfig'.  Stop.
You have 8 cpu cores
Ready to start compiling! Enter 'time nice make bindeb-pkg' -j'YOUR NUMBER OF CORES HERE' to start compiling with multi-core mode..

###############################################################
# deb-file creation will start. Do you want to continue?      #
#                                                             #
#   - Make sure configuration changes are correct!            #
############################################################### 
(y|Y)es (n|N)o # 

It looks like they won't compile or failed of tar

SoulInfernoDE commented 2 years ago

Just enter the kernel version number without the build addition -40. For example: correct: 5.15.0

wrong: 5.15.0-40

report back if it works or if you get further errors.

Edit: You can also try to build the newest 5.15.49 for example ;-)

Edit: I updated the script to include patchutils as requirement as it seems that interdiff is not installed as default on some systems which is needed to reverse a patch :smile:

DeafMan1983 commented 2 years ago

Hey I have already tried but my current kernel version is see in my first post.

I have typed 5.15.0 then it seems not found anything.

./cfs_noguimerge.sh
Kernel Pull Merge Script v0.1a
Installing dependencies
[sudo] password for deafman1983: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
autoconf is already the newest version (2.71-2).
bc is already the newest version (1.07.1-3build1).
bison is already the newest version (2:3.8.2+dfsg-1build1).
build-essential is already the newest version (12.9ubuntu3).
cmake is already the newest version (3.22.1-1ubuntu1).
cpio is already the newest version (2.13+dfsg-7).
dkms is already the newest version (2.8.7-2ubuntu2).
fakeroot is already the newest version (1.28-1ubuntu1).
flex is already the newest version (2.6.4-8build2).
gawk is already the newest version (1:5.1.0-1build3).
kmod is already the newest version (29-1ubuntu1).
libdw-dev is already the newest version (0.186-1build1).
libelf-dev is already the newest version (0.186-1build1).
libglib2.0-dev is already the newest version (2.72.1-1).
libiberty-dev is already the newest version (20211102-1build1).
libncurses-dev is already the newest version (6.3-2).
libncurses5-dev is already the newest version (6.3-2).
libpci-dev is already the newest version (1:3.7.0-6).
libxi-dev is already the newest version (2:1.8-1build1).
nano is already the newest version (6.2-1).
packagekit is already the newest version (1.2.5-2ubuntu2).
zstd is already the newest version (1.4.8+dfsg-3build1).
dwarves is already the newest version (1.22-8).
libglade2-dev is already the newest version (1:2.6.4-2.4).
libgtk2.0-dev is already the newest version (2.24.33-2ubuntu2).
libpackagekitqt5-dev is already the newest version (1.0.2-1).
qt5ct is already the newest version (1.5-1build1).
dpkg-dev is already the newest version (1.21.1ubuntu2.1).
git is already the newest version (1:2.34.1-1ubuntu1.2).
libssl-dev is already the newest version (3.0.2-0ubuntu1.5).
openssl is already the newest version (3.0.2-0ubuntu1.5).
libudev-dev is already the newest version (249.11-0ubuntu3.1).
The following packages were automatically installed and are no longer required:
  libapparmor1:i386 libasound2:i386 libasyncns0:i386
  libdbus-1-3:i386 libflac8:i386 libogg0:i386 libopus0:i386
  libpulse0:i386 libsamplerate0:i386 libsndfile1:i386
  libsystemd0:i386 libvorbis0a:i386 libvorbisenc2:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
mkdir: cannot create directory ‘kernel’: File exists
Which kernel version do you want to compile? (example: 5.18.1) 5.15.0
kernel version you entered: 5.15.0_android
--2022-06-25 15:54:48--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:6f::432, 199.232.189.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:6f::432|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-06-25 15:54:48 ERROR 404: Not Found.

tar: linux-*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Downloading the ASHMEM source code removal patch from upstream
--2022-06-25 15:54:48--  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=721412ed3d819e767cac2b06646bf03aa158aaec
Resolving git.kernel.org (git.kernel.org)... 2604:1380:4601:e00::1, 145.40.68.75
Connecting to git.kernel.org (git.kernel.org)|2604:1380:4601:e00::1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘remove_ashmem.patch’

remove_ashmem.p     [ <=>  ]  32,04K  --.-KB/s    in 0,02s   

2022-06-25 15:54:48 (1,36 MB/s) - ‘remove_ashmem.patch’ saved [32814]

Reverting the removal patch code..
./cfs_noguimerge.sh: line 24: interdiff: command not found

Patching the kernel sources to bring back ASHMEM..

DONE! ASHMEM is now selectable again in your kernel .config file! NOTE: THIS MAY BREAK ANYTIME AS ASHMEM IS REPLACED WITH MEMFD
which is not supported by Anbox yet..
make: *** No rule to make target 'olddefconfig'.  Stop.
Configuration file with standard defaults options: 5.15.0_android has been created..
--2022-06-25 15:54:48--  https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/main/nogui/.config-fragment
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8000::154, 2606:50c0:8002::154, 2606:50c0:8003::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8000::154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 302 [text/plain]
Saving to: ‘.config-fragment.3’

.config-fragmen 100%[=====>]     302  --.-KB/s    in 0s      

2022-06-25 15:54:49 (38,4 MB/s) - ‘.config-fragment.3’ saved [302/302]

./cfs_noguimerge.sh: line 37: ./scripts/kconfig/merge_config.sh: No such file or directory
merging new android options into the .config file:
make: *** No rule to make target 'olddefconfig'.  Stop.
You have 8 cpu cores
Ready to start compiling! Enter 'time nice make bindeb-pkg' -j'YOUR NUMBER OF CORES HERE' to start compiling with multi-core mode..

###############################################################
# deb-file creation will start. Do you want to continue?      #
#                                                             #
#   - Make sure configuration changes are correct!            #
############################################################### 
(y|Y)es (n|N)o # 

And it can't create but my current version of Ubuntu 22.04: is Kernel-version 5.15.0-40 What does it mean for current version like 5.15.0 or 5.15.1....

Thanks!

SoulInfernoDE commented 2 years ago

Aaah sorry i guess kernel.org removed the last digit for a main version number. So you need to enter 5.15 instead of 5.15.0

So the last number of your main kernel version is simple a update for your kernel branch (which also contains security fixes and so on..). Ubuntu for example does test their updates a longer time before adding them to ubuntu. So as you can already get the updated kernel versions and use it for ubuntu itself it takes some more days to get them.

Edit: If the patch script line detects that some files already exists just say [n]o.

You can view the changes between 5.15 and 5.15.50 here for example: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/?id=v5.15&id2=v5.15.50&dt=2

DeafMan1983 commented 2 years ago

Thanks I got 5.15 and downloading source of kernel and it compiled successfully.

But it looks output why does i have an error if I dpkg -i linux-*.deb then it happens because it doesn't find cause errors... image

Reverting the removal patch code..
./cfs_noguimerge.sh: line 24: interdiff: command not found

Patching the kernel sources to bring back ASHMEM..

DONE! ASHMEM is now selectable again in your kernel .config file! NOTE: THIS MAY BREAK ANYTIME AS ASHMEM IS REPLACED WITH MEMFD
which is not supported by Anbox yet..
.config:8865:warning: symbol value 'm' invalid for ASHMEM
.config:9945:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
.config:9946:warning: symbol value 'm' invalid for ANDROID_BINDERFS
#
# configuration written to .config
#
Configuration file with standard defaults options: 5.15_android has been created..
--2022-06-25 20:04:04--  https://raw.githubusercontent.com/SoulInfernoDE/compile-kernel-from-source/main/nogui/.config-fragment
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8002::154, 2606:50c0:8000::154, 2606:50c0:8003::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8002::154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 302 [text/plain]
Saving to: ‘.config-fragment.5’

.config-fragment.5     100%[===========================>]     302  --.-KB/s    in 0s      

2022-06-25 20:04:04 (33,4 MB/s) - ‘.config-fragment.5’ saved [302/302]

Using .config as base
Merging .config-fragment
Value of CONFIG_ANDROID_BINDER_IPC is redefined by fragment .config-fragment:
Previous value: # CONFIG_ANDROID_BINDER_IPC is not set
New value: CONFIG_ANDROID_BINDER_IPC=y

Value of CONFIG_SYSTEM_TRUSTED_KEYS is redefined by fragment .config-fragment:
Previous value: CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"
New value: CONFIG_SYSTEM_TRUSTED_KEYS=""

Value of CONFIG_SYSTEM_REVOCATION_KEYS is redefined by fragment .config-fragment:
Previous value: CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"
New value: CONFIG_SYSTEM_REVOCATION_KEYS=""

Value of CONFIG_ASHMEM is redefined by fragment .config-fragment:
Previous value: # CONFIG_ASHMEM is not set
New value: CONFIG_ASHMEM=y

Value of CONFIG_LOCALVERSION is redefined by fragment .config-fragment:
Previous value: CONFIG_LOCALVERSION=""
New value: CONFIG_LOCALVERSION="-android"

#
# configuration written to .config
#
merging new android options into the .config file:
#
# No change to .config
#
You have 8 cpu cores
Ready to start compiling! Enter 'time nice make bindeb-pkg' -j'YOUR NUMBER OF CORES HERE' to start compiling with multi-core mode..

###############################################################
# deb-file creation will start. Do you want to continue?      #
#                                                             #
#   - Make sure configuration changes are correct!            #
############################################################### 
(y|Y)es (n|N)o #

It looks error cause not supported.... :( my display card is Radeon RX 480

EDIT: i replace with -j8 but your shell script looks failed that is why I replaced and it works fine...

SoulInfernoDE commented 2 years ago

Thank you for helping me with my script - it helps a lot to fix errors which sometimes occurs on other systems, so i can optimize it more in a general way :+1:

can you show me the output of this command: ls ~/Downloads/linux-*.deb

image

I am using also a Radeon graphics card. The kernel configuration will be taken from your current running kernel. So if you have a radeon graphics card it will take the configuration also for the new kernel built from source. :smiley:

DeafMan1983 commented 2 years ago

Welcome my best @SoulInfernoDE ! But it seems I takes longer with dbg.,how do I skip debug version? 20220625_212602

I see your picture how does it take minutes longer? If you get successful with debug version?

SoulInfernoDE commented 2 years ago

Sure the debug-symbols is not always needed and is very big i know. Im not sure if you can exclude the generation of the debug symbols deb-file but you can just delete or move the linux-dbg.deb file next time you compiled from source before installing it with sudo dpkg -i linux-*.deb so it won't get installed. If you successfully installed your fresh compiled kernel files then you can reboot and try to start with your new kernel. But first check if your boot menu is correctly configured to be able to select all your installed kernels you want to boot under the advanced menu at boot start: cat /etc/default/grub | grep GRUB_TIMEOUT should show you something like this: image which means that after restarting your computer you see a menu and auto start will be done in 3 seconds when nothing is pressed on the keyboard.

You can edit the file with a text editor: sudo gedit /etc/default/grub after you changed something in that file and have saved it you need to update the system with the new file: sudo update-grub

If your computer blocks it while you want to start, then you need to sign your compiled kernel with your own uefi/secure boot key. I also have a script made for that in case you need it just let me know.

DeafMan1983 commented 2 years ago

And I have got successful debs then it happens because 2 ko modules throw errors. image

I will look...

SoulInfernoDE commented 2 years ago

You need to uninstall the modules now because they are "burned in your new kernel" and no more needed as external modules. You should be able to do that with: sudo dkms status sudo dkms remove -m anbox-ashmem -v 1 sudo dkms remove -m anbox-binder -v 1

after successfully removal you can check the status of your ashmem and binder with: uname -a && ls -1 /dev/{ashmem,binder}

should show you something like this:

image

DeafMan1983 commented 2 years ago

Yeah you are correct but I don't have modules It is really impossible because I don't have modules yet

sudo dkms remove -m anbox-ashmem -v 1
Error! There is no instance of anbox-ashmem 1 for kernel 5.15.0-40-generic (x86_64) located in the DKMS tree.
deafman1983@deafman1983-desktop:~$ sudo dkms remove -m anbox-binder -v 1
Error! There is no instance of anbox-binder 1 for kernel 5.15.0-40-generic (x86_64) located in the DKMS tree.

Cause It got error. I think It doesn't find if I see before sudo dkms status:

$ sudo dkms status
anbox-ashmem/1: added
anbox-binder/1: added
v4l2loopback/0.12.5, 5.15.0-39-generic, x86_64: installed
v4l2loopback/0.12.5, 5.15.0-40-generic, x86_64: installed
v4l2loopback/0.12.5, 5.15.0-android, x86_64: installed

I can't remove both modules.. but I already use "sudo"

SoulInfernoDE commented 2 years ago

hmh the removal needs a correct command line sometimes i forget how it was formed.. ..does this work?

sudo dkms remove -m anbox-ashmem -v1 or sudo dkms remove -m anbox-ashmem/1 or sudo dkms remove -m anbox-ashmem/1 --all

DeafMan1983 commented 2 years ago

Wow thanks my friend :D sudo dkms remove -m anbox-ashmem/1 --all

It works fine. Thanks It can remove ... :D

Then I will resolve again...

SoulInfernoDE commented 2 years ago

Very cool - glad it worked :smile:

Could you boot your newly installed kernel and did you check the output of uname -a && ls -1 /dev/{ashmem,binder} yet? :grin:

I think checking of installed module and removing it with the script is a good update. Will add that now :grinning:

DeafMan1983 commented 2 years ago

I am very disappointed why is binder not successful for me :( ?

I am broken on floor. :/ I can't fix that. I don't understand why does it happen with Ubuntu 22.04 I don't believe that if it doesn't support for me.

SoulInfernoDE commented 2 years ago

So binder is not active?

Could you try this and show me the output?:

sudo mkdir /dev/binder sudo mount -t binder binder /dev/binder

If you have anbox installed could you also check: anbox system-info

I am very disappointed why is binder not successful for me :( ?

I am broken on floor. :/ I can't fix that. I don't understand why does it happen with Ubuntu 22.04 I don't believe that if it doesn't support for me.

If it is in the kernel sources it is definitly supported. I guess it is. I'll help you out as far as i can :smiley:

Also this output should be of a good help for me: cat /boot/config-5.15.0-android | grep BINDER

should show something like this: image

SoulInfernoDE commented 1 year ago

I am very disappointed why is binder not successful for me :( ?

I am broken on floor. :/ I can't fix that. I don't understand why does it happen with Ubuntu 22.04 I don't believe that if it doesn't support for me.

Do you still need help for this? :-)

Sudococommunity commented 1 year ago

i need help i have binder module running but ashmem module is not there and i dont have android.img too my os 6.1.0-1parrot1-amd64 based on debian

Sudococommunity commented 1 year ago

anbox

Sudococommunity commented 1 year ago

anbox1

Sudococommunity commented 1 year ago

anbox2

SoulInfernoDE commented 1 year ago

For Ashmem you could try the fix from @choff

First remove the ashmem dkms module you already have installed and delete the copied files from the original source.

Then download the ashmem folder with the ashmem.c fix from here: https://github.com/choff/anbox-modules/tree/master

Finally follow the readme for the part with Ashmem.

Froggio5543 commented 1 year ago

Im a little confused as to what I should do to fix this error. Which .deb file should I install or which of your guides should I follow to fix this? I am currently using debian 11 if that helps. Thank you! Screenshot 2023-06-26 12 37 14 PM

SoulInfernoDE commented 1 year ago

You have linux system with kernel 5.15 it seems that binder is not present in some way.

Could you please show us the output of this command: cat /boot/config-5.15.108-18910-gab0e1cb584e1| grep BINDER

This will show us if you have BINDER inside your kernel or not.

Froggio5543 commented 1 year ago

Ok image

SoulInfernoDE commented 1 year ago

Oh seems the file is named else maybe this works?: cat /boot/config-$(uname -r) | grep BINDER

Froggio5543 commented 1 year ago

nope, it gives me the same output image

SoulInfernoDE commented 1 year ago

oof that is very strange but then lets try to find out if binder is there anyhow with this:

sudo mkdir /dev/binder && sudo mount -t binder binder /dev/binder