[Galaxy S I9000 Q&A, Help & Troubleshooting] n01ce:
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.

./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":

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:

From this thread @ ubuntu-phone team mailing list archive:

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)

me@ubuntu:$ adb shell
shell@GT-I9000:/ $ su
root@GT-I9000:/ # cat /dev/mtd/mtd2 > /sdcard/mtd2.img
root@GT-I9000:/ # exit
shell@GT-I9000:/ $ exit
me@ubuntu:$ adb pull /sdcard/mtd2.img
me@ubuntu:$ ./boot_info mtd2.img
PAGE SIZE: 1278632501
BASE ADDRESS: 0x65640000
RAMDISK ADDRESS: 0x78773241
CMDLINE: 'BA...[output omitted here]
me@ubuntu:$ ./split_boot mtd2.img
Android Magic not found in mtd2.img. Giving up.
kris@ubuntu:~/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)

$ 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.

$ 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.