yashsingh1/xdaforums huggingface dataset:
[Galaxy 3 Android Development] Nil253259:
I am a .net developer and this reminds me something.the other day I was reviewing some code and saw there was a bunch of codes under both if(true) and else part..I called the writer and asked the reason.he said those lines of code were very important. So when true=true code will be executed..but what about one unfortunate day when true may be equal to false..then what? To be on safe side he wrote same code on else part....sorry for little OT but I can't help not sharing it...:)
[Galaxy 3 Android Development] z3c0:
I guess the ifdef stuff was used as makeshift flags in order to switch blocks of code on and off for some testing / debugging. The whole thing looks like it was adapted by a single person with limited experience / regard for best practices. As soon as the program was sort-of running he abandoned it without cleanup.

If there are a lot of further files of that "quality", perhaps I can help sift through them and clean them up so you don't have to do that dumb stuff.
[Galaxy 3 Android Development] hillbeast:
Don't worry, I'm rewriting everything. The old stuff is destined for the trash can. All it's good for is finding what device is plugged into what and how it's configured. I will be using mainline code as much as possible (drivers for devices), using more common ways of configuring drivers (copying how stuff is done on the likes of S5PV210 dev boards like SMDKV210 and Goni, and if drivers aren't in mainline, I'll port drivers from tom3qs Spica kernel. IF and only IF I still can't find a better alternative will I port old Samcrap drivers.

At least the SoC is close to S5PV210 and I've got most of the SoC code done now, and it's soon just going to be all driver stuff, and luckily the drivers are mostly in the Galaxy S (or even Nexus S) or the Galaxy Spica, both of which have good clean 3.0 kernels.
[Galaxy 3 Android Development] bsuhas:
Do you ever get to sleep Mark? You are working continuously....really hats off to you.
[Galaxy 3 Android Development] balamu96m:
As the logcat indicates the error with the letter 'E' in the beginning of the log, i think the error is this:

E/Zygote ( 185): setreuid() failed. errno: 2

I believe:

Calling of the function setreuid() fails.

Also - error no 2 is defined as "File/directory not found"

But i think it is because the calling the function is not privileged.

As per this site (here) :

I'm not very sure about this.

I hope i'm not diverting anyone!
[Galaxy 3 Android Development] hillbeast:
I'm redownloading the CM9 sources as all I have on me is CM10.1 from working with my Nexus 7. That's gonna take all afternoon probably. I think I'll be remaking the device repository for Apollo from scratch because a lot of the old hals will probably be broken. I know that current CM stuff is all hacked around Android PMEM when we're moving over to ION, and that could be the cause of some of these problems.

Time to compile Android for Goldfish I guess...
[Galaxy 3 Android Development] hillbeast:
Nexus S kernel and platform code looks very interesting to me. A lot of similar hardware in there, but most importantly: excellent code. Might start using that as a reference as it's closer than SMDKV210 or Goni.
[Galaxy 3 Android Development] balamu96m:
i have a doubt bro,

ION was introduced by Google in ICS & for sure it'll be helpful for us in CM9+. But will it work for CM7 too ??

Thanks in advance!
[Galaxy 3 Android Development] hillbeast:
We'll need to implement PMEM for that. That's why I'm working with CM9 now, as I think ION should be working already, unless I need to set it up somewhere?
[Galaxy 3 Android Development] bgm0:
Hi, awesome work !!! How about trying "TinyAndroid" to help in this early stage in the kernel.

Also I'm trying to build a Linaro toolchain any tips for the croostool-ng config. I'm starting with the RPi config that uses the same armv6.

https://wiki.linaro.org/Platform/Android/UseTinyAndroid
[Galaxy 3 Android Development] cdesai:
That looks like its linaro specific.

Android does have such an option though, BUILD_TINY_ANDROID, which when set to true only builds a minimal version of the system needed for board bring up, which I already suggested to hillbeast :)

Also, for hill beast, it'ld be better if you could ask marcellusbe for the new BSP he was working on, and modify that instead of doing a new one again.
[Galaxy 3 Android Development] hillbeast:
The Linaro system also looks like all it gives me is a shell, which I already have.
[Galaxy 3 Android Development] tom3q:
...

Sorry for my absence. I haven't visited the forum after receiving last post notification and I wasn't getting notifications about further posts...

For s5k4ca sensor driver you should look at my heavily cleaned version for Spica (based on the driver from apollo kernel):

https://github.com/tom3q/spica-3.0/blob/android-s3c64xx/drivers/media/video/s5k4ca.c

For (mostly) generic libcamera using V4L2 interface (compatible with mainline s5p-fimc and my s5k4ca drivers):

https://github.com/tom3q/android_device_samsung_spica/tree/gingerbread/libcamera

The HAL library is only for Android 2.3, as newer versions require another HAL interface, unless there is some wrapper available. V4L2CameraHardware.cpp needs still a bit of cleaning and fixes for video recording, but basic image preview and snapshots should work.

EDIT:

Well, excellent is a bit too strong word for it, but in most places the code is good enough to be used with minor adjustments only. In other places, like libaudio or libcamera, could be much cleaner than is.

EDIT2:

For a (mostly) generic libaudio implementation (for Android 2.3 and with compatibility layer for Android 4.x):

https://github.com/tom3q/android_device_samsung_spica/tree/gingerbread/libaudio

AudioRouter is the place to make most of platform-specific edits in.

EDIT3:

ION devices must be configured in board file, just like PMEM.
[Galaxy 3 Android Development] hillbeast:
Thanks for the information. I will look into implementing ION. That could be why Android just sits there and doesn't boot.
[Galaxy 3 Android Development] tom3q:
For this issue I would recheck kernel config and init scripts. Missing ION would give some error message.

Also the kernel might need TLS patch:

https://github.com/tom3q/spica-3.0/commit/37d3778436e4d129f11e03427f7c89af496b0cc2

This is caused by bionic which is retarded and forces software TLS on ARMv6, while the kernel without this patch enables only hardware TLS.

Patching bionic would be better, because hardware TLS might give some performance benefits, but this would be much more invasive and could cause some regressions, so I decided to just hack the kernel instead.
[Galaxy 3 Android Development] hillbeast:
Apparently the kernel already has this patch. Have you submitted it to mainline or something?
[Galaxy 3 Android Development] tom3q:
Hmm, now as I think of it, I probably already gave you this patch before.

Btw. I saw you applied some ancient CMA patches to your tree. Don't do it, as it's a really early version and doesn't work correctly in many cases. If you want to add CMA you can apply much newer version backported to the Linux 3.4 LTSI kernel:

http://git.linuxfoundation.org/?p=l...daa829d9b0196162ce623ad1637d696a80c;hb=master

(patch application order is listed here: http://git.linuxfoundation.org/?p=l...24e0caf55e18cea6aca62f96f955f74950d;hb=master , just the dma-mapping patches are interesting for us)

For CMA integration with ION there are patches from Linaro:

http://lists.linaro.org/pipermail/linaro-mm-sig/2012-December/002832.html

But for now, to just allow further work, I'd recommend using ION carveout heaps and just statically reserve some part of memory at the top for ION. Also you don't need all the heaps you defined, if I remember correctly, for now just one default heap would be enough. The memory allocated using ION is used only for multimedia devices, so I wouldn't blame it for any boot failures at the moment.
[Galaxy 3 Android Development] hillbeast:
Okay well I will update CMA later if it gives me any problems. It seems to be working fine though. I mainly assumed that the Nexus 10 would have had a decent version being the latest and greatest from Samsung.

CMA seems to be working though. Its reserving some memory and it initialises without error. I'll have to figure out this problem with Android booting first. Could the fact /dev/random isn't working right have anything to do with it ?
[Galaxy 3 Android Development] tom3q:
Well, it is not the CMA I was writing about some time ago. It's the previous concept of CMA which was just a tool for statically reserving system memory with some special requirements, like memory alignment, certain location in memory, etc. It has nothing to do with the CMA that gives us the ability to not reserve the memory statically and allocate it dynamically instead.

Does /dev/urandom works correctly? It's the random generator mostly used in Android.

/dev/random is feed directly by entropy-generating events, like input, network and block devices so it might not have much random data if there aren't many events happening in the system. Also it is rarely used, just in cases where true randomness is needed - mostly for generation of cryptographic keys.
[Galaxy 3 Android Development] hillbeast:
So is this CMA not the full fledged version ?

I'm not sure if urandom works. Haven't bothered to test it. I'll check it when I get home and let you know.
[Galaxy 3 Android Development] tom3q:
Yes, it's a completely different solution, created before the concept changed into a fully dynamic allocator.
[Galaxy 3 Android Development] hillbeast:
Okay I'll implement the version you linked me. It seems that the Nexus 10 much like everything else Samsung gets their dirty fingers on has outdated junk in its kernel. Samsung has a bad habit of making a bits and pieces kernel.
[Galaxy 3 Android Development] tom3q:
Samsung is not the only manufacturer, which does so. This is somehow caused by Android kernel being out of sync with mainline, while this is mainline where most of the interesting work related to mobile devices takes place recently. (Another reason was mainline not being enough mobile-friendly before.)

It is not that easy to backport features from newer kernels and even much harder to implement new feature in a good way. The solution to this problem is usually (as you can see) just to make a solution that is enough to given use case and that works (in given use case).

It was last year when the LTSI kernel initiative was announced and this makes a chance that we'll get a bit cleaner kernels on future mobile devices.
[Galaxy 3 Android Development] hillbeast:
Oh yeah I know Samsung aren't the only ones guilty of it. I really hope that Android gets merged into mainline properly. Its annoying that mainline is on 3.7 stable and is in 3.8 release candidates while Androids latest kernel lags behind on 3.4. Like sure there aren't anything major to justify needing 3.7 but there shouldn't be anything holding us back from updating to the absolute latest and greatest from mainline.

I'm hoping that with the changes they're making to ARM kernel will also clean things up.
[Galaxy 3 Android Development] tom3q:
Not even on 3.4. The stable Android kernel for Jellybean is 3.0. Android-3.4 is the development branch... But let's hope that the work on mainlining Android kernel code is progressing well.

I hope so. Forcing multiplatform builds (supported currently, in Linux 3.8, only with selected platforms) and Device Tree-based hardware description (which I'm involved into) should also make hacks and other insane solutions much harder, enforcing doing things properly. I just hope that this will not cause hacking existing hacks using even bigger hacks...
[Galaxy 3 Android Development] hillbeast:
That's very true. There are only like 3 or 4 devices that run on kernel 3.4 and one of them is the Nexus 4, and I'm not sure what Manta is on but I think that's 3.4 as well. Grouper is 3.1.10 and the Galaxy Nexus is still 3.0 I think. These are all flagship devices and they're almost a year behind mainline. Heck the Galaxy S3 and even the Xperia T are kernel 3.0.

When this gets finished, the Galaxy 3 will be one of the few devices that will be on such a modern kernel. Perhaps down the track I could try merge kernel 3.8 into it but that's not a priority.

EDIT: I think HTC are still dicking around on kernel 2.6 on a lot of their devices too. Correct me if I'm wrong.
[Galaxy 3 Android Development] ak700:
Manta is on 3.4.X ATM. I think Galaxy S 3 is on 3.1
[Galaxy 3 Android Development] Darius_AWS:
Galaxy SIII is on 3.0

Envoyé depuis mon GT-I9300 avec Tapatalk
[Galaxy 3 Android Development] hillbeast:
/dev/urandom works. /dev/random does not.
[Galaxy 3 Android Development] moikop:
Apparently I don't get to start Android...

~ # /init
[ 227.980783] !@Init process: device_init #3
[ 228.491993] init: cannot open '/initlogo.rle'
[ 228.501694] EXT4-fs (mtdblock1): VFS: Can't find ext4 filesystem
[ 228.503007] EXT4-fs (mtdblock2): VFS: Can't find ext4 filesystem
[ 228.509259] EXT4-fs (mtdblock3): VFS: Can't find ext4 filesystem
[ 228.517149] init: Unable to open persistent property directory /data/propert2
[ 228.526112] init: cannot find '/system/etc/init.apollo.sh', disabling 'apoll'
[ 228.531435] init: wifi.mac_addr: check_wifi_address()
/sbin/sh: can't access tty; job control turned off
[ 228.544799] init: [WLAN] Sleep before insmod Wi-Fi Driver !!
~ # [ 233.548200] init: Loading the wifi driver DRIVER_MODULE_ARG:firmware_pa
[ 233.556202] init: load_file() failed!!
[ 233.560085] init: insmod() failed!!
[ 233.563528] init: wifi.mac_addr: Loading wifi-module failed!
[ 233.569463] init: Cannot open "/system/bin/.BT_38_4M.hcd": Unknown error: -1

I see the "Android_" and I get to console at least... have you gone through this already?
[Galaxy 3 Android Development] tom3q:
Hmm, are you trying to mount ext4 file system on raw flash memory? This is a good way to kill the flash memory (assuming the file system is being mounted in writable mode). Ext4 doesn't provide any wear leveling or bad block handling, so yaffs2 or ubifs must be used on raw NAND flashes (OneNAND is one of them).
[Galaxy 3 Android Development] hillbeast:
Need to format those partitions and install

Android.

I chose ext4 for now because yaffs is slow as sin and ubifs is annoying to set up for just testing.
[Galaxy 3 Android Development] tom3q:
Good luck.
[Galaxy 3 Android Development] hillbeast:
As I said, its for now. I don't care if my OneNAND gets knackered. I'd just replace the thing with a high speed SD card and install Android on that if I wanted.
[Galaxy 3 Android Development] tom3q:
Well, if you want to get rid of this phone quickly, then I guess it's a good solution.

Is it really that hard to setup UBI layout once and then just use it virtually forever? It's just a matter of including proper tools in your initramfs.

The setup procedure is very simple, assuming that you have a big single MTD partition on which multiple UBI volumes will be located:

1. Erase the partition using flash_erase or flash_eraseall.

2. Attach it using ubiattach.

3. Create needed volumes using ubimkvol.

4. That's all, just mount the volumes wherever you want.

Formatting is as easy as with ext4, just with different tool, not mkfs.ext4, but ubiupdatevol instead.

Btw. Even highest speed SD card will be still slower than internal OneNAND with proper flash filesystem. Especially considering the fact that the sdhci-s3c controller isn't the fastest.
[Galaxy 3 Android Development] moikop:
Damn, didn't know.. will change to yaffs2 right now and once it's finished may set ubifs... Thanks.
[Galaxy 3 Android Development] hillbeast:
Don't know why I didn't think of this earlier, but I did ps to find out what process it is that keeps crashing, and it's app_process. I also saw dexopt is running, and it's starting to build a dalvik-cache of some core frameworks (system@framework@core.jar@classes.dex, system@framework@ext.jar@classes.dex, system@framework@framework.jar@classes.dex). Dunno what any of that means.

As for not using UBIFS, I've pulled much hair trying to get it to work. It insists that it's either not a typewriter, or that it's not an MTD device. I've decided it's easier to just kill the phone than it is to lose more life over dealing with UBIFS. Perhaps when the kernel is working better I'll care more about it, but I just can't be bothered wasting time on it if it's not going to cooperate.
[Galaxy 3 Android Development] tom3q:
You can try to attach strace to it and check what syscalls it calls before it hangs/crashes. Useful strace switches: -p, -f, -F.

Are all your flash partition free from bad blocks? Ext4 will not handle them (while they are something normal on nand flash), leading to access errors.

If you can't set up UBI properly then I'd recommend to move straight to using SD card for rootfs. This will save your time, prevent hard to track errors caused by using inappropriate filesystem with raw flash and spare your onenand memory.
[Galaxy 3 Android Development] hillbeast:
I'm currently using a second partition on my SD card as /system so that I can change files on it easily to fix up Android.
[Galaxy 3 Android Development] hillbeast:
strace of app_process: http://pastebin.com/xhHxHy0v

I had to put it on Pastebin because XDA is limited to 30000 characters. Kind of stupid restriction if you're a RD...
[Galaxy 3 Android Development] moikop:
Seems to me like something is killing it rather than just crashing
[Galaxy 3 Android Development] hillbeast:
Perhaps, but I'm assuming mprotect is a memory function that protects memory, and that's the last thing it's doing so I'm assuming that fails for some reason. I'll poke around.
[Galaxy 3 Android Development] tom3q:
Looking at strace output, nothing in app process seems to fail. It looks like something is killing it. The message about untracked pid suggests that its parent process exits or crashes and init terminates it.

You could also try to add -F option to also follow vforks.
[Galaxy 3 Android Development] Arjav23:
It's amazing and great to see all of you developers work so hard on the g3

Best of luck guys and i hope this project is completed soon!
[Galaxy 3 Android Development] hillbeast:
The parent process for app_process/zygote is servicemanager, which I can't do an strace of because it dies too quickly for me to even be able to pgrep it or do ps aux on it. Anyone got any good ideas?
[Galaxy 3 Android Development] marcellusbe:
is it possible to do it by modifying init.rc which launch servicemanager ?
[Galaxy 3 Android Development] hillbeast:
So change it to run a script that will strace it at the same time? I'll have a go.
[Galaxy 3 Android Development] cdesai:
Also, take a look at logwrapper.
[Galaxy 3 Android Development] balamu96m:
Cdesai bro: different topic: will the cwm touch recovery source be released?? Can you give me?? Currently in need of it...

thanks & sorry for off-topic.,
[Galaxy 3 Android Development] hillbeast:
Somethings really not right in this kernel because it's still not behaving right. Even basic stuff like busybox has issues like not returning to the shell prompt after running a command, certain binaries just saying cannot link image, etc.
[Galaxy 3 Android Development] tom3q:
I'd check system timer(s). This would also explain /dev/random not working.

As for "cannot link image" errors, this looks more like missing or incorrect dynamic libraries needed for this binary.
[Galaxy 3 Android Development] hillbeast:
Okay I'll take a look tomorrow. Right now I'm tired and don't want to do much, mainly wanted to test a few things. Enabling those options in config fixed a few things, but not much.
[Galaxy 3 Android Development] mankokoma:
do not hurry, just do this post to see the topic on top! thanx! :D
[Galaxy 3 Android Development] andreapier:
R: [PROJECT] Kernel 3.4.x For Galaxy 3

Hillbeast and moikop, are you encountering some hard walls?? Progresses have stopped for some time now, but they used to be SO fast... What's going on? Techinacl stuff or simply busy with private life?

Thanks!
[Galaxy 3 Android Development] moikop:
In my case, I might just be getting stupid or something... because since I came back from my trip, I haven't been able to get to the same place HB is (in other words, all the builds I do are broken), (And I swear that while I was away I didn't smoke pot or anything! :angel: lol, kidding of course). Anyway, every build I make just gets me to the same broken place, and it doesn't give me any usable information. I tried in a couple of different build environments, with different compilers and nothing. Even redone the environment setup a couple of times... I tried not to bother HB a lot with this so he wouldn't also waste his time with this stupid problem..

And I still have another month at least of holidays until I start university, so I got enough free time to work on this...
[Galaxy 3 Android Development] tom3q:
Well, IMHO it would be better if you could post any details about your problem here, so we could help you.

Sometimes a minor overlooked detail (e.g. typo) can lead to very hard to track errors and after a long time working with some part of code (or whatever) the author stops seeing such stupid mistakes, which another person could spot quickly.
[Galaxy 3 Android Development] tom3q:
Hmm, does anything show up on the screen? It looks like it has switched to framebuffer console ("Console: switching to colour frame buffer device 30x25") and so only kernel output then appears on UART.

Could you try to configure the kernel to use built-in command line arguments containing console=ttySAC1,115200n8? An option for this should be available in Boot options.
[Galaxy 3 Android Development] moikop:
Same thing. I don't think that's ever been a "problem", given that it's been always there (at least in 3.x, and if I'm not wrong in 2.6 too).

...
[ 0.000000] Ignoring tag cmdline (using the default kernel command line)
...
[ 0.723174] io scheduler noop registered (default)
[ 0.723208] io scheduler deadline registered
[ 0.723321] io scheduler cfq registered
[ 0.732923] Console: switching to colour frame buffer device 30x25
[ 0.736843] s3c-fb s3c-fb: window 0: fb
[ 0.737509] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[ 0.753957] s5pv210-uart.0: ttySAC0 at MMIO 0xec000000 (irq = 74) is a S3C640
0/10
[ 0.754635] s5pv210-uart.1: ttySAC1 at MMIO 0xec000400 (irq = 75) is a S3C640
0/10
[ 1.730403] console [ttySAC1] enabled
[ 1.734585] s5pv210-uart.2: ttySAC2 at MMIO 0xec000800 (irq = 76) is a S3C640
0/10
[ 1.742974] ramoops: platform device not found, using module parameters
[ 1.748569] ramoops: The memory size and the record size must be non-zero
[ 1.755128] ramoops: probe of ramoops failed with error -22
[ 1.778634] brd: module loaded
[ 1.788153] loop: module loaded
[ 1.789372] nbd: registered device at major 43
[Galaxy 3 Android Development] tom3q:
Does it really hang for a whole second between those two lines? This and @hillbeast's problems would suggest that there is something wrong with clockevent device.
[Galaxy 3 Android Development] hillbeast:
It has that huge delay on my end as well. I just never noticed it because that is all happening when the console isn't showing anything yet because the serial drivers haven't started.
[Galaxy 3 Android Development] tom3q:
I doubt this is related to the main problem, but you should change the maximum number of VICs available in the system in arch/arm/common/Kconfig.

config ARM_VIC_NR
int
default 4 if ARCH_S5PV210
default 3 if ARCH_S5PC100
default 2
depends on ARM_VIC
help
The maximum number of VICs available in the system, for
power management.

It should be "default 3 if ARCH_S5PC100 || ARCH_S5P6442" probably.

Another thing is that looking at your irqs.h, it seems to be copied from S5PV210, while in original kernel and mainline 2.6.39 (last one before dropping S5P6442), they aren't exactly the same. In particular there is no VIC3 and some IRQs are not available.

For comparison:

Yours: https://github.com/sg3/android_kern...3.4/arch/arm/mach-s5p6442/include/mach/irqs.h

Original: https://github.com/dharamg3/G3MOD/blob/master/Kernel/arch/arm/plat-s5p64xx/include/plat/irqs.h

Mainline: http://lxr.free-electrons.com/source/arch/arm/mach-s5p6442/include/mach/irqs.h?v=2.6.39;a=arm