[Q] Compiling kernel for Desire HD on ARM system (not cross compiled) - General Questions and Answers

Hello. I am trying to compile and boot a Cyanogenmod-7 kernel for the HTC Desire HD. My first attempt was from a Debian chroot running on the phone. I managed to compile the kernel, but was unable to boot it. For testing, I unpacked boot.img, and repacked it with the original files and kernel, and was able to boot that... this confirmed the problem was the kernel, and nothing else. I believe I tried the Kali- and Cyanogenmod-msm7x30 sources.
Realizing that compiling on the phone was impractical, I decided to buy a Trim Slice embedded system (an A9 cpu, 1gb memory, 500gb storage). I also realize that Android kernels are cross compiled, but I preferred native architecture because there are some advantages (regression tests). This Trim Slice runs Ubuntu Natty, with GCC Linaro 4.5.2.
I can not cross compile from my workstation because it is OpenBSD, and does not do such things.
Now, more carefully, I downloaded the Cyangenmod 7 kernel sources, with the same git pull version as the shipped kernel. /proc/config.gz and cyanogen_msm7230_defconfig are identical. I made no changes to the config. I used 'make CROSS_COMPILE='. I compiled mkbootimg natively, and did flash_image on the phone, rebooted, and same thing... the HTC screen for infinity.
So then I built GNU Patch-2.7 statically linked (it's a balance between a complex program and a simple program), and copied it to the phone, and './patch --version' works fine. So my compiler is fine... it is compiling for the correct platform.
What could be going wrong with my kernels? Is my GCC version to blame?.. /proc/version says the phone's kernel was built with gcc-4.4.3.
Is there a boot loader that can turn my phone's usb port into a serial port/console so I can see what is going on?

Related

[Q] Cross compiling C software for my android

Hi,
I've download the Android source with "repo", and it includes cross compiler toolchains for various architectures.
I want to build a package (for now, mtd-utils) for my android phone (a htc hero), but I'm having limited success understanding how to get this working. I was thinking there was something I could do, like change my $PATH and set up some other environment variables, that would use the tools from the toolchain instead of the system default ones, so that the binaries would be built for the phone instead of for my computer. But it certainly doesn't seem to be that easy...
I've reverted to attempting a "Hello world" program, but when I try to compile even that using the included toolchain tools, I run into trouble:
Code:
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -o hello hello.c
hello.c:1:19: error: stdio.h: No such file or directory
hello.c: In function 'main':
hello.c:5: warning: incompatible implicit declaration of built-in function 'printf'
so I tried a couple of other variants:
Code:
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -I $HOME/src/mydroid/bionic/libc/include -o hello hello.c
$ $HOME/src/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gcc -static -I $HOME/src/mydroid/ndk/build/platforms/android-8/arch-x86/usr/include/ -o hello hello.c
but they both give (different) errors about what other include files are missing when referenced from somewhere.
Is there some "easy" way to android-ify a source tree, so that I can build sources using the cross compiler toolchains? Or should I fetch a different cross compiler toolchain to use, like benno did in his document from 2007? He uses a codesourcery toolchain and builds with that instead (as referenced in other articles here on the subject).
Would much appreciate any shared tips or experiences on how to accomplish this.
The tool chain is fine the problem is non of the include/lib are set up correctly to find the needed version of the includes. Remember the default includes under linux depend on glibc and android only supplies bionic.
Have a look here for more info on setting up bionic:
http://android-dls.com/wiki/index.php?title=Compiling_for_Android
Though if you get the full source for glibc (or precompiled arm binaries) you could compile a dependant program staticly (I think that's what busybox does)
Building for older versions of Android
I was actually able to compile a program manually today, specifically one of the programs in the mtd-utils package. After lots of jumping back and forth, I have found out that the 64 bit version of Ubuntu is what I needed, and also sun-java-1.6, contrary to almost all information I found out there. Then I was able to build AOSP, and then I was able to get "agcc" working, the wrapper that sets environment variables automatically as needed.
So I compiled the app, but it didn't work on my Android. Trying to run it in an adb shell gave approximately this error (from memory):
/bin/sh: ./program: No such file or directory
though the program was there. I didn't use strace, but concluded that this is because of a missing shared library. I have a very recent version of AOSP, while the phone is running Android 2.0 or something like that, so that's a plausable reason why this is happening.
I tried to rebuild the program using "agcc -static ...", but that doesn't work because I don't have the static version of libc after building AOSP, so it just dies with a linker error complaining that it can't find -lc.
So now I need to figure out how to build for old Android version using my checked out version of AOSP, or I need to figure out how to check out an old version of AOSP using repo.
Any tips would be much appreciated.

WITS a81e and Milestone Overclock

.I have been trying to get my tablet wits a81e uses a omap3 chipset to load a module. it uses Android 2.2 and the uname -r on the unit is 2.6.32 instead of 2.6.32.9 like the other modules droid_22 and milestone leak that are supplied. i am trying to compile the module and when it creates it it appears to be based on the overclock-mod.c file instead of the overclock.c file. Is there somthing special I should be doing?
I am using ubuntu and the google ndk. I compile and I end up with the .ko file which will load. There are no kern messages other than the kernel is tained. If I run strings overclock.ko I only can basically see the .modinfo from the file.
I have worked on this forever....Can you give any suggestions?
TY
Bruce

Need help installing Fedora 17 arm on Folio 100

Hi all,
there's some fantastic stuff on your forum and I would like to thank you all for work being done here!
Now, to my point. I need kernel source (or update.zip or zImage or boot.img or whatever ) that can support systemd so I can run Fedora 17 arm on my Toshiba Folio 100.
I tried using kernel 3.1 form DerArtem (the guy who has done amazing work with folio) but it has no framebuffer console. I tried adding support for this myself (following this guide: kernel.org/doc/Documentation/fb/fbcon.txt) but it didn't work. There's no surprise there as I am newbie when it comes to compiling kernel and changing its options.
I succeeded in starting Fedora 12 arm with older kernel using this guide (lguegan.free.fr/article.php3?id_article=29) which is inspired by you guys. It worked all right, but I didn't want to go deeper with it because F12 arm didn't have LibreOffice (or OpenOffice) in its repos and Fedora 17 did. Also, Fedora 17 has core support for multi-touch - apps do need to implement this feature though, but the funcionality is there.
And if there is someone who can help me, I can point you in a few directions:
Kernel source for 3.1: github.com/DerArtem/android_kernel_toshiba_betelgeuse
Fedora 17 arm rootfs: fr2.rpmfind.net/linux/fedora-secondary/releases/17/Images/
I am not sure which image you should use SFP or HFP as I don't know what kind of floating point Folio uses.
I am making boot.img with this command:
Code:
#mkbootimg --kernel arch/arm/boot/zImage --cmdline "[email protected] [email protected] vmalloc=192M video=tegrafb usbcore.old_scheme_first=1 tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR root=/dev/mmcblk1p1 init=/sbin/init usb-storage.delay_use=0 rootdelay=10" -o boot.img --ramdisk boot.img-ramdisk.gz
maybe there is something wrong right there, but I don't know what half of these kernel parameters do
Also, maybe I am using wrong config file: arch/arm/configs/tegra_betelgeuse_android_defconfig, please do correct me.
Now that I think, I just need config file for this 3.1 kernel, so basicaly that's the help I need.
Thanks in advance and again thank you for all the good stuff here
Momcilo
Hmmm interesting project. Mabey some day you can tell us how you got Fedora 12 to work. I saw that DerArtem is working on a kernel over on his github page: https://github.com/DerArtem/, mabey it will work with your build?
Did you also read through the linux post in the general section? (link)
Hi friend!
Well, getting Fedora 12 arm to work was fairly easy. Just flashed with kernel from that page you posted and copied Fedora 12 rootfs to an mmc and it booted with console. X was not even installed in rootfs so before I tried to make it work I realized that there was no office for that version of Fedora arm so I dropped it.
Reason I can't use kernel from that page you posted is: it's too old. Fedora 17 uses systemd which requires newer kernel. That's why I came here, to try and contact DerArtem to see if his new kernel 3 for Folio could be configured to boot up other OSes, because I tried reconfiguring myself but got stuck.
Thanks for your interest in this
Its been a while since i build my own kernel, but it seems to me that you need to have a F17 build system and then build the kernel with the config for the Folio 100 (Fedora arm Kernel building)
I'm currently trying to get Archlinux working on my folio (Still i know).
I don't have problem building a kernel. It builds just fine, and I do get zImage and I can flash my Folio with it and it boots up. Only problem I have at the moment is that I can't seem to get framebuffer console working so I can debug booting Fedora from MMC.
and then build the kernel with the config for the Folio 100
Click to expand...
Click to collapse
Yeah, that's what I am missing
The config for the kernel is in:
arch/arm/configs/tegra_betelgeuse_android_defconfig
You will have to enable the framebuffer console as it is disabled it the kernel.
Hi DerArtem,
thanks for taking time to look at my work.
I think there was a mistake in my earlier efforts that I didn't realize, because now I did it from start and framebuffer works like a charm. I also added support for systemd (devtmpfs, cgroups, etc...) and now my Fedora 17 arm boots to console.
I am so happy right now I can't even try to debug why X doesn't work, but I'll get there.
If I make this work completely I will make a guide and post it here.
Thanks guys!
May I suggest u post your issues here, perhaps we can help you with these ?
thanks
P.S. Fedora is not really my distribution of choice(prefer debian or arch), but nevertheless make it working is a great advance
Thanks sader0!
I will need help with this.
Here are the logs:
dmesg - dm.txt
lsusb - lsusb.txt
/var/log/messages - messages.txt
Xorg -configure - Xorg.0.txt
lspci - doesn't produce anything.
And another thing, I didn't copy anything from kernel tree after compiling. I noticed during kernel build that something compiles as module but I had trouble finding any modules.
Is there anything I should copy to filesystem from kernel tree?
Best regards,
Momcilo.

[Q] Running Ubuntu for Arm, how to cross compile command line programs for Android?

Using Linuxdeploy I installed ubuntu (for arm with hardware floats) on my tablet.
It runs beautifully, and I can install packages with apt-get, or (and I just did it to upgrade bison) compile from source using gcc 4.6 and all the other tools.
BUT, nothing I compile from within linux will run outside of the linux jail. I can copy the files out, but they won't run even if the permissions are set to execute.
"gcc -abi=armeabi" doesn't make any difference.
I guess I can install the same tools that people use to compile for android on x86 machines, but it seems like overkill and maybe breaks the advantage of being able to use standard linux build tools. Is there a different set of libraries to link to? A different linker? Different linker settings? Different gcc options?
Josh

Ubuntu 3.16 kernel

I read a while back about an open source driver for the tegra 2. If I remember correctly it first became mainline in 3.16. I've installed Ubuntu 14.04 on a TF101 using a 3.1 kernel, but there are problems, mainly sleep doesn't work. So, I wanted to try a newer kernel with the open source driver. It looks like the default kernel for 14.04 is 3.13, but there is a 3.16 kernel available. I installed it, now I am trying to create a kernel blob that will boot.
The thing is, I can not successfully repack the original. The problem apears to be with abootimg process. If I just blobunpack and blobpack, it works. But, if I extract the LNX and recreate it using the same files, boot fails.
Has anyone else tried this?
Well, I figured out the issue with my repacks not working. Nothing to do with abootimg. The DE was automounting the boot partition, which silently broke the dd of the blob to the partition in most cases.
Still no luck with a new kernel though. It just hangs on the eeepc splash. I did find that the ubuntu kernel uses a different kernel compression. Looks like gzip vs. lzma. Not sure if that is the issue, or the kernel is failing to load for some other reason.
Same problem with a 4.0.x kernel.
However, same splash was seen when I've tried to cross-breed Ubuntu with Katkernel with a disabled android GUI. It still displayed splash, but ubuntu was up and running.
It may be possible than something wrong with framebuffer driver and/or mmc (tegrapart?) simultaneously.
I think I have discovered the root problem. There is some code in arch/arm/mach-tegra that would either need to be ported, and/or, a flattened device tree would need to be created and appended to the kernel. Since FDT support was added to obsolete the need for machine specific code, that is probably all that is needed. This is all initial discovery to me though and I have not yet found if there is an easy way to generate a table, or if we can use something that is already out in the wild.
I did find that the compiler is available via apt-get install device-tree-compiler, and that the compiled file can be appended to the kernel image via CONFIG_ARM_APPENDED_DTB (under Boot Options). There is a lot of documentation in Documentation/devicetree/usage-model.txt

Categories

Resources