[Q] kernel .config for S3-I9305 LTE.. 3.0.31-7xxx - Galaxy S III I9305 (4G LTE + 2GB RAM) Q&A, Help &

Hi,
I have build a custom kernel image with default config m3_00_defconfig from samsung.
but the kernel modules after successful compilation are different from the stock,
Below are the differences after extracting initramfs from the stock boot image and with kernel modules built with default config.
Modules after successful kernel compiled with m3_00_defconfig
Code:
./drivers/net/wireless/bcmdhd/dhd.ko
./drivers/net/wireless/btlock/btlock.ko
./drivers/scsi/scsi_wait_scan.ko
./arch/arm/mvp/pvtcpkm/pvtcpkm.ko
./arch/arm/mvp/mvpkm/mvpkm.ko
./arch/arm/mvp/commkm/commkm.ko
Modules from stock kernel XXBLL5
Code:
lib
│** └── modules
│** ├── btlock.ko
│** ├── dhd.ko
│** ├── [COLOR="Red"]exfat_core.ko[/COLOR]
│** ├── [COLOR="Red"]exfat_fs.ko[/COLOR]
│** └── scsi_wait_scan.ko
Modules marked as RED are missing.
Is it because of different config used?
If yes, could some one please share the .config file.
I have no clue if i'm missing some steps to compile. please suggest me.
Thanks in advance

Fixed, got it working thanks to ErGo_404
kernel devs, please follow the link for more details
http://forum.xda-developers.com/showpost.php?p=37738902&postcount=4

Related

Patch to compile module tattoo-hack yourself...

A little patch to insert the tattoo-hack module to the kernel source
and compile it as a module.
After applying the patch, run make with LOCALVERSION=-gf922713 or
what ever version you have (see with uname -a) :
$ make LOCALVERSION=-gf922713
That's all
cya

[Q] [KERNEL] How to build boot.img from custom zImage on Galaxy S I9000 (galaxysmtd)?

Hello,
I try to port bcmon to CyanogenMod 11, by building the custom bcmon (bcm4329) kernel module for CM11. As modules are very dependent on the kernel version and configuration (unknown symbol errors even when compiled on the same exact kernel version), I have no other choice but to build the full CM11 kernel.
So I've built a CyanogenMod 11 kernel directly from the kernel source (ARIES kernel), NOT from the full CyanoGenMod system source (which is about 20GB source files, much more for built files, and takes hours to build [tutorial here]).
After some debugs, I managed to get the kernel zImage and .ko modules.
- fbmem.c has an issue with relative samsung/s3cfb.h path: make it absolute
- other bugs listed here (post end)
I also managed to build a ramdisk (initramfs) by manually builing it from the source files in aries usr/galaxysmtd_initramfs_files folder.
I used boot.img "kitchen" tool.
Code:
./repack_ramdisk galaxysmtd_initramfs_files ramdisk.gz
Still, I can't manage to build a proper boot.img with these files. Of course, building a boot.img file "works":
Code:
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel zImage --ramdisk ramdisk.gz -o boot-new.img
Indeed I feel this file is gonna screw up my device boot (at least there will still be the recovery...).
Why? Because I believe Galaxy S boot.img is different than from other devices. And that seems to be an issue for other developers as well:
didhiy said:
Since I don't know how to unpack & repack boot.img on cm-10.1, I use stratosk ramdisk with some modification to suite my needs.
Click to expand...
Click to collapse
From this thread @ ubuntu-phone team mailing list archive:
Alistair Buxton said:
from http://wiki.sourcemage.org/HowTo(2f)Initramfs.html and http://comments.gmane.org/gmane.linux.kernel/1027539 this does indeed appear to be a built in initramfs inside the zImage. This is different to the way most android devices use mkbootimg to combine a zImage and ramdisk. In a real CyanogenMod rom for galaxysmtd, boot.img is not a mkbootimg image, nor is it it my earlier ubuntu-touch port. The offsets in System.map seem to be before compression, so perhaps this isn't the whole story, but for sure both kernels have an initramfs with different contents, and nothing else gets added later.
Click to expand...
Click to collapse
Kitchen tools and unpack-bootimg.pl just don't understand how boot.img file is structured for galaxy S1.
Tried to split the existing device boot.img from /dev/mtd/mtd2... (400MB)
Code:
[email protected]:$ adb shell
[email protected]:/ $ su
[email protected]:/ # cat /dev/mtd/mtd2 > /sdcard/mtd2.img
[email protected]:/ # exit
[email protected]:/ $ exit
[email protected]:$ adb pull /sdcard/mtd2.img
[email protected]:$ ./boot_info mtd2.img
PAGE SIZE: 1278632501
BASE ADDRESS: 0x65640000
RAMDISK ADDRESS: 0x78773241
CMDLINE: 'BA...[output omitted here]
[email protected]:$ ./split_boot mtd2.img
Android Magic not found in mtd2.img. Giving up.
[email protected]:~/Documents/android/kernel/aries_output$ ./unpack_bootimg.pl mtd2.img
Found a secondary file after the ramdisk image. According to the spec (mkbootimg.h) this file can exist, but this script is not designed to deal with this scenario.
Tried to split the existing device boot.img from CWM full backup... (7MB)
Code:
$ adb pull /storage/sdcard1/clockworkmod/backup/.../boot.img
$ ./boot_info boot.img
PAGE SIZE: 24061976
BASE ADDRESS: 0xe1a00000
RAMDISK ADDRESS: 0xe1a00000
CMDLINE: '_wl
dwl'
$ ./split_boot boot.img
Android Magic not found in boot.img. Giving up.
$ ./unpack_bootimg.pl boot.img
Could not find any embedded ramdisk images. Are you sure this is a full boot image?
So how do you exactly create a boot.img from a kernel zImage on Galaxy S1?
Without letting the CyanogenMod magic works with the hassle of compiling the whole CyanogenMod android system files...
NB: By the way, I try to just compile the kernel from full CM system source as per official instructions... and of course it failed.
Code:
$ make -j8 out/target/product/galaxysmtd/boot.img
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4.2
CM_VERSION=11-20140126-UNOFFICIAL-galaxysmtd
TARGET_PRODUCT=cm_galaxysmtd
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a8
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.11.0-15-generic-x86_64-with-Ubuntu-13.10-saucy
HOST_BUILD_TYPE=release
BUILD_ID=KOT49H
OUT_DIR=/.../cm/out
============================================
/.../cm/out/target/product/galaxysmtd/obj/APPS/SignatureTest_intermediates
find: "src": Aucun fichier ou dossier de ce type
build/core/Makefile:44: attention : écrasement des commandes pour la cible « /.../cm/out/target/product/galaxysmtd/system/etc/permissions/android.software.live_wallpaper.xml »
build/core/base_rules.mk:529: attention : anciennes commandes ignorées pour la cible « /.../cm/out/target/product/galaxysmtd/system/etc/permissions/android.software.live_wallpaper.xml »
build/core/Makefile:44: attention : écrasement des commandes pour la cible « /.../cm/out/target/product/galaxysmtd/system/etc/permissions/android.software.live_wallpaper.xml »
build/core/Makefile:44: attention : anciennes commandes ignorées pour la cible « /.../cm/out/target/product/galaxysmtd/system/etc/permissions/android.software.live_wallpaper.xml »
build/core/Makefile:44: attention : écrasement des commandes pour la cible « /.../cm/out/target/product/galaxysmtd/system/lib/libril.so »
build/core/base_rules.mk:529: attention : anciennes commandes ignorées pour la cible « /.../cm/out/target/product/galaxysmtd/system/lib/libril.so »
build/core/Makefile:44: attention : écrasement des commandes pour la cible « /.../cm/out/target/product/galaxysmtd/system/bin/rild »
build/core/base_rules.mk:529: attention : anciennes commandes ignorées pour la cible « /.../cm/out/target/product/galaxysmtd/system/bin/rild »
PRODUCT_COPY_FILES device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml ignored.
PRODUCT_COPY_FILES device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml ignored.
PRODUCT_COPY_FILES device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml ignored.
PRODUCT_COPY_FILES hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf ignored.
No private recovery resources for TARGET_DEVICE galaxysmtd
make: *** Pas de règle pour fabriquer la cible « out/target/product/galaxysmtd/boot.img ». Arrêt.
edit:
You missed this part from my sc02b thread
>> Stock cm-10.1 kernel
file: cm-10.1-sc02b-kernel-yyyymmdd.zip
Finally (May 2013) I found proper way to unpack stock kernel using this kernel-repack and repack again using a part of script from here
Click to expand...
Click to collapse
check this:
https://github.com/didhiy/ramdisk-aries
I use a script for i9100 from chirayudesai github (already deleted), it works for extracting i9000 boot.img
unfortunately in newer lzma version (I'm on ubuntu precise), the script failed
my way to solve the problem is use lzma binary from older version (natty)
the newer version of lzma only soft linked to xz binary, so I removed lzma, lzmainfo & unlzma from /usr/bin/
put lzma & lzmainfo binaries from natty, last create unlzma softlink to lzma binary
Thanks didhiy.
Finally I abandoned the idea to build the kernel alone, this is deprecated by CyanogenMod since CM9.
But CyanogenMod IRC users gave me the following tip to avoid the long android system build. Instead of brunch'ing CM, we can just compile the kernel boot.img directly from source by using the following command (after having setup the whole CM build environment etc.).
Code:
mka bootimage
I've edited the CyanogenMod wiki to explain all this in details:
CyanogenMod wiki: Integrated Kernel Building
i have the same exact problem for a while!
hi,
im happy ive found this topic,but sad to find out u abandoned the idea
my problem is,i dont have enough hard drive on system,(beside the awful internet speed), so i dont want to download the whole 20GB!...
so i preferred to download just some of dependencies which is described in an xml file...
so,all in all,do u know which packages is needed to compile just the boot.img,and not the whole rom zip file?

[help] Is my (stock) compiled kernel/boot.img good?

I created a (complete) copy paste like OnePlus kernel source ready to compile: my kernel source
I just need someone who knows more stuff about this topic to take a quick look if my build.sh (target is OnePlus 7 but could be configured for pro) creates images that do not brick the device.
boot.img creation:
build.sh
uses the stock ramdisk from OOS 11.0.0.2 global of OP7
I am wondering how and if the resulting boot.img can be actually flashed because it is much smaller than the original: 32.718.848 bytes (my) vs 100.663.296 bytes (original)
How did my repo came together?
Depth: 1, Branch: oneplus/SM8150_R_10.0
vendor_kernel -> /oneplus (Makefile merges it while building)
kernel -> /msm-4.14
audio_kernel -> /msm-4.14/techpack/audio
stock defconfig: from my OP7 (proc/config.gz) running 11.0.0.2 global
ready stock defconfig: Disabled module signing, CONFIG_BUILD_ARM64_KERNEL_COMPRESSION_GZIP=y, CONFIG_BUILD_ARM64_DT_OVERLAY=y

How to compile only magiskboot for linux x86_64?

A makefile or something would be nice to have...

Using Gentoo?? Why using gcc? Use clang compiler instead (fast and less ram-eater)

!!!! WARNING !!!!
-> This Article is for "Gentoo" or Gentoo-based linux users only..
-> Follow this article carefully otherwise u may break ur system completely, resulting in reinstallation of Gentoo
NOTE!! >>>
->This article will be updated always
-> Using clang instead of gcc isn't recommended but u can use clang if u follow this guide fully
-> Some packages fail with gcc and need clang to compile even if u don't need clang and vice versa (some packages even fail with clang)
Read Carefully -->>
Hello everyone !
First of all I apologize for any spelling mistakes made by me
This is a full guide to use clang as the default compiler for packages in ur pc with Gentoo linux installed
Make sure u read these manpages first >> make.conf , man make.conf and GCC Optimization
This articles says to use clang as the native compiler for ur system but not tells to completely replace gcc
Most of the linux distros use glibc which needs gcc and makes it impossible to use clang as the only compiler in the system i.e., u can't completely remove and replace gcc with clang
Some packages have gcc in their default config files which makes them break in using clang coz this makes the package to use clang with gcc (mixing compilers)
But..... There are still several packages which compile well with clang without any errors
Wait!! Why am I telling to use clang instead of gcc??
ans-> Clang is much faster than gcc and uses far less ram.. It has a special feature called thinlto which optimizes the package/app to provide more performance and uses much less ram than full lto or gcc lto..... gcc has no thinlto... Clang also uses lld as default linker which is much faster than gold/bfd..
For using clang we need to completely build our clang environment first and then properly setup
Below are the steps::
1) First of all, edit /etc/portage/make.conf file and set this :- USE="${USE} -clang -llvm"
2) Run "emerge -av clang llvm compiler-rt llvm-libunwind lld" to compile and install the clang toolchain with gcc first.. This isn't enough, don't use clang now in any case
3) Now make a dir named "env" in /etc/portage by running "mkdir -v /etc/portage/env"
4) Make a separate clang environment by running command "nano /etc/portage/env/compiler-clang" and add the following lines :
CC="clang"
CXX="clang++"
LD="ld.lld"
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"
STRIP="llvm-strip"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS} -stdlib=libstdc++"
LDFLAGS="-stdlib=libstdc++ -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed"
or for thinlto
CC="clang"
CXX="clang++"
LD="ld.lld"
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"
STRIP="llvm-strip"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
CFLAGS="-march=native -O2 -pipe -flto=thin"
CXXFLAGS="${CFLAGS} -stdlib=libstdc++ -flto=thin"
LDFLAGS="-stdlib=libstdc++ -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,-O2 -Wl,--as-needed"
5) Edit /etc/portage/make.conf and add this -> USE="${USE} clang llvm default-compiler-rt default-lld llvm-libunwind -default-libcxx" ...
Note here we have added a few changes in USE flag: removed "-" present in-front of clang and llvm and also added "default-compiler-rt default-lld llvm-libunwind -default-libcxx"
Also here we putted a "-" in front of default-libcxx to prevent clang from using libc++ by default instead of libstdc++ as libc++ and libstdc++ aren't ABI compatible
Why dont use libc++??
ans-> As I previously said, most of linux distros use glibc and for which we can't remove gcc.. before installing clang u have gentoo installed on ur system with packages installed with gcc which uses libstdc++ by default
Here if u compile some packages with libc++, then they may not work untill u rebuild all gentoo linux packages with libc++ which is a lengthy and time consuming process.. So I don't recommend to use libc++.. Only use libstdc++
Let me give an example
Suppose u compiled package A with libstdc++ .. Now u are compiling package B which needs package A as dependency to work with libc++.. U will see that the installation may fail or be sucessful.. If sucessful, the package may not work properly as libc++ and libstdc++ aren't ABI compatible...
There are only two ways to fix this type of problem,
a) Compile package B with libstdc++ EASY
b) Compile package A and its dependencies with libc++ HARD
So use libstdc++
6) We have properly set our clang environment but the clang toolchain isn't completely built yet
If the clang toolchain is not properly bootstrapped then u may get lld linker errors
So its needed to build a proper clang toolchain
Make a file/edit /etc/portage/package.env and add these lines
sys-devel/llvm compiler-clang
sys-libs/libcxx compiler-clang
sys-libs/libcxxabi compiler-clang
sys-libs/compiler-rt compiler-clang
sys-libs/compiler-rt-sanitizers compiler-clang
sys-libs/llvm-libunwind compiler-clang
sys-devel/lld compiler-clang
sys-devel/clang compiler-clang
With these lines we are forcing packages listed here to compile using the separate clang environment we created in /etc/portage/env/compiler-clang rather than using default gcc compiler set in make.conf....
This means we will now recompile the whole clang toolchain using the clang compiler itself, making a proper clang toolchain..
7) Finally rebuild the whole clang toolchain with the command "emerge clang llvm libcxx libcxxabi compiler-rt llvm-libunwind lld"
8) Make a gcc fallback environment for packages failing with clang or for those which compulsory eed gcc in /etc/portage/env/compiler-gcc by adding these lines
CC="gcc"
CXX="g++"
LD="ld.bfd"
NM="gcc-nm"
AR="gcc-ar"
RANLIB="gcc-ranlib"
STRIP="strip"
OBJCOPY="objcopy"
OBJDUMP="objdump"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-fuse-ld=bfd -Wl,-O2 -Wl,--as-needed"
9) Now edit /etc/portage/package.env and add these lines to prevent packages that compulsory need gcc from using clang
# Compulsory gcc needed
app-admin/eselect compiler-gcc
app-arch/bzip2 compiler-gcc
app-arch/gzip compiler-gcc
app-arch/xz-utils compiler-gcc
app-arch/tar compiler-gcc
app-shells/bash compiler-gcc
net-misc/rsync compiler-gcc
net-misc/wget compiler-gcc
sys-devel/autoconf compiler-gcc
sys-devel/automake compiler-gcc
sys-devel/libtool compiler-gcc
sys-apps/baselayout compiler-gcc
sys-apps/makedev compiler-gcc
sys-apps/coreutils compiler-gcc
sys-apps/diffutils compiler-gcc
sys-apps/file compiler-gcc
sys-apps/findutils compiler-gcc
sys-apps/gawk compiler-gcc
sys-apps/grep compiler-gcc
sys-apps/less compiler-gcc
sys-apps/net-tools compiler-gcc
sys-apps/portage compiler-gcc
sys-apps/sed compiler-gcc
sys-apps/shadow compiler-gcc
sys-devel/binutils compiler-gcc
sys-devel/bison compiler-gcc
sys-devel/flex compiler-gcc
sys-devel/gcc compiler-gcc
sys-devel/gettext compiler-gcc
sys-devel/gnuconfig compiler-gcc
sys-devel/make compiler-gcc
sys-devel/patch compiler-gcc
virtual/editor compiler-gcc
virtual/libc compiler-gcc
virtual/os-headers compiler-gcc
virtual/pkgconfig compiler-gcc
sys-apps/which compiler-gcc
DONE !!
Now we have a clean and proper clang environment
If u want to use clang system-wide, replace the envs like CC="" CXX="" LDFLAGS="" LD="",etc from /etc/portage/env/compiler-clang in /etc/portage/make.conf, otherwise put "package/name compiler-clang" in /etc/portage/package.env for those packages u need clang (if not using clang system-wide), e.g. dev-qt/qtwebengine compiler-clang
If u are using clang system-wide then some packages may fail to compile.. To fix this, put "package-name compiler-gcc" in /etc/portage/package.env to use the gcc fallback environment..
We are good to go now..
Enjoy Clang's fast compilation speed and less ram usage
U may ask does clang really use less ram?
ans-> Yes, when compiling qtwebengine with make -j6 using gcc, the ram usage was above 8gb
but with clang, ram usage was less than 5gb
I Hope This Guide Helps
EDIT 1: All The places where I used -march=native in CFLAGS/CXXFLAGS should be updated by urself according to ur processor specs... Please read the gcc-optimization article I pasted in the starting and put -march=specificcpu to optimize all packages according to ur processor... Also some packages don't support -march=native and need -march=specificcpu to work
EDIT 2: Using -O3 instead of -O2 in CFLAGS/CXXFLAGS isn't recommended unless u have a high end pc with atleast 16gb ram because, clang's "-O3" is an alias of "-O2 -flto" ... -flto enables full link time optimizations which will consume a lot ram during compilation.... If u still want to optimize ur applications more than "-O2", then I recommend u to use "-O2 -flto=thin" which will activate clang's thinlto instead of full lto and thinlto uses a few more ram compared to "-O2" but hugely less than full lto
EDIT 3: Some packages also fail to compile with lto .. If u face any package failure due to lto , then disable full lto or thinlto by removing "-flto=thin / -flto / -flto=full" from CFLAGS and CXXFLAGS
to be continued::::

Categories

Resources