Android Kernel Development using linux [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am interested in developing kernel for android phones. I searched on internet about android kernel development and i got how to build kernel on linux machine means only how to use tools for create a custom kernel but i want to know how to write code to make android kernel. How to start with c programming and ALP. Please guide me.

Android uses Linux kernel and that is why you should get familiar with Linux first.
From you post I am guessing that you don't know much of C programming language. Before you start doing any kernel work you should be able to write an application in C because if you cannot write an application you probably will not understand a kernel.
To start leaning C there are dozens of resources everywhere, I would recommend the book "C programming language" by Brian W. Kernighan. and Denis M. Ritchie (inventor of C).
Application runs in so called "User mode" and have only access to Virtual Memory that is given to them by the kernel. If the application tries to access memory that is not in its Virtual Space the kernel sends an abort signal. This prevents the system from crashing. In kernel the is not the case because the kernel runs in "Kernel mode" and thus has access to the whole address space when you do something wrong the consequences can range from halting the system to wiping permanent storage and more.
So first learn how to write applications, maybe a native applications, try to use the functionality that is provided by the kernel by learning about "System calls". For this purpose I would recommend the books "Advanced Linux Programming" by Mark Mitchel, it is freely hosted on its website http://advancedlinuxprogramming.com/. You can find some reference here https://en.wikibooks.org/wiki/The_Linux_Kernel.
If you are comfortable with both C and the Services the Linux kernel provides. Than you can start thinking about diving into the kernel. Very popular book is "Linux kernel development" by Robert Love. Although I don't think it is very up to date It should cover the major topics related to that subject,there are probably resources out there that are more up to date.
This is a long journey and you should really think about it first, depending on what you want to do you may actually be able to do it in "User Space".

Related

Is it possible to get source code of my Android device? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have background about android application development and now I want to explore deeper side of the Android.
Because of Android is open source, I want to find my phone's source code, then change some values in code, and after all I can compile and flash the code into the phone and see the changes.
I know there is an android documentation here but it is not clear for me.
So, my question is how can I download the source code of my phone?
You haven't specified your device type so here are some more general ideas:
Basically it is not that simple and depends on your device. Parts of Android are open source, other parts are not. Furthermore, your Android device can have a locked bootloader which won't allow you to install your custom build firmware.
Your link shows you how to download the current Android source code using the repo tool. Usually, Android is not in a single git repo. The repo tool reads from a configuration file the different git repositories, current branches, etc. and clones them for you.
I did Android development for OMAP devices (in the past). OMAP itself is outdated but you can learn alot from the documentation: http://omapedia.org/wiki/Main_Page Furthermore, you can still buy OMAP dev boards and play around with them, build a custom image, patch things, etc.
Building a custom Android for OMAP devices works like this:
Clone Android source code
Clone Linux Kernel
Clone U-Boot bootloader
Build all three and create image files
Flash them on the device
A few words about open source: Many things ar eopen source, but not everything. E.g. GPU driver are closed source. In case of OMAP devices, you can get them precompiled. So if you want to touch something which is not open source, you run into problems.
I hope that helps you and points you a little bit into the right direction.

Python programming from my phone? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device.
I'm confused in the difference between Kivy and Sl4a and what steps i need to take in order to be able to program and run my game on my phone. I seem to only be able to find outdated or misleading information, so i apologize if this is simple.
Any guidance is much appreciated. Thanks!
I have searched to the point of confusion, so I need some guidance. I want to make a game on Android with Python - ONLY using my android device.
As others have said, this is somewhere between 'really hard and annoying' and 'impossible'. Especially without a computer to do any of the process!
I'm confused in the difference between Kivy and Sl4a
Kivy is a cross-platform (linux, windows, osx, android, ios, maybe more) graphical framework for python. The same developers maintain a python-for-android project that lets you very easily compile a kivy program to an android apk. You can also do java api interaction etc. using the pyjnius project, which is also maintained by the same devs, and some apis (vibrate, accelerometer etc.) are already abstracted as a python module so you don't have to touch java.
sl4a was originally (I think) a way to run python scripts on android. It has its own way to do some stuff with the android apis, but I don't know the details or what is possible. There are also some ways to package as an apk or to do some kinds of graphical work, but I'm not familiar with this either - I think they're much more limited as a graphical framework than kivy is (not that it sets out to be a full framework in the same way), but I don't know much about it, and at the very least the graphical stuff works in a quite different way that has advantages of its own.
(Edit: Notice all the 'I think' in the previous paragraph? That's because I really don't know for sure and don't want to say something wrong. Don't take my word for it, try it!)
Overall, kivy and sl4a (plus both of their related projects) are separate projects, with different focuses and technical capabilities. I personally think kivy is a more obvious choice for purposes other than basic scripting (though even simple sl4a scripts are useful to make tasker scripts etc.), but while some of kivy's advantages are arguably objective, some of my opinion is subjective.
what steps i need to take in order to be able to program and run my game on my phone
This is really a big topic on its own. Already knowing kivy, I reckon I could throw together a process to do it, but I'd absolutely not want to because it would need a horribly painful mishmash of other tools interacting in ways that are not a good user experience. In essence, I'd use text editors to create android files to run with kivy's interactive launcher (which is on the play store), and can probably in principle compile to an apk using kivy's online buildozer tools. However, I'll really stress that this is only in principle possible and I can't recommend trying - I think android really does not have a good set of tools for general purpose programming of this sort, and the os doesn't fit well with the multitasking of coding.
If you just want to write scripts and run them, you may have more luck. You can look at apps like qpython and codepad2 lite, along with the sl4a stuff (and probably other apps, these are just a couple I've seen or tried recently) for apps that can let you edit and run these kinds of scripts. This might be usable for certain things, but even then I don't think it would be a fun experience if you also need to switch between reading docs in a different app etc.
So overall...certain things are possible, but building full apps with (say) kivy is not likely to be an easy or pleasant experience with the current tools. Since you say you're constrained by circumstance and not choice, I suggest playing with qpython etc. and seeing what happens, but you aren't missing some fabulous ide that takes all the pain away.

Why do iOS and Android force you to write the UI in the native App Programming language? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
:) When you write a iOS App, in order to use the UI like buttons. you have to write it in Objective-C. (Java on Android). I was wondering if anyone had any thoughts on the technical reasoning behind this. Why they might of done this. As you can write apps in C++ on iOS so I've never fully worked out why they didn't expose a way of making the UI in that. (Ignoring the fact that this is how they did it on the Mac).
Note: I know you can write apps in c++ for Android but the question is more why is the main UI i.e buttons etc forced to be written in a dynamic language for these platforms, why not expose access to it thorough C++ without having to write a crude wrapper or binding layer yourself.
I'm guessing that when the original framework engineers were working on their respective operating systems, cross-platform desires like UI support in a different language like C++ was at the bottom of their concerns. You'll have to realize that when deadlines loom, all of the features are prioritized only what is considered most important is made to work. Everything else is a consequence of that.
In the case of iOS, Objective-C is the language of choice for the OS that Apple uses. All of the MacOS app developers were writing in Objective-C so their developer based was in familiar territory.
In the case of Android, Java was already a popular language, with existing open source tooling and libraries (Eclipse IDE, Apache Harmony), so presumably they decided to use Java as the first class language for app development with apps running in a VM as a consequence. Alternatively the decision may have been VM first for the sandboxing of apps and Java was picked as the language for app developers. Or some other reason.
In either case any attempt to add in additional languages now that both are in the hands of customers means design decisions and trade offs along with a host of other questions like: how to add it in without breaking existing APIs, how to support it along with new features, how to test, etc. etc.
As you see more and more software, you'll realize that lots of stuff is just arbitrary or made sense at the moment of when it was designed.
iOS does expose a C API for drawing UI components; it's called Core Graphics.
Because the view itself is written in Objective-C, or Java, respectively. When in Rome, do as the Romans do.

Haskell interpreter on Android? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is there a Haskell interpreter (with standard libraries) that can be installed on Android?
So that someone with an Android device can do some Haskell exercises on an Android device: write and run some example code in Haskell.
Hugs is written in C and quite portable. It should be possible to port it to Android.
Taking a note from imz, all you need is
ConnectBot or similar
A remote machine with
Vim, Emacs, or similar
runghc / ghci / hugs / yourfavoritehaskellinterpreterorcompiler
It's not as solid as a dedicated app or scripting layer would be, but honestly, for your use cases, it would provide almost exactly the same functionality as those options (if not more). And it would be just as "mobile" as a website (depends only on the uptime of the host and the connectivity of the client).
You can use tryhaskell.org from your mobile browser. It will accept any valid expression, but keep in mind that defining your own data types won't be possible.
For some negative information, all the work I've seen for GHC on Android (such as http://ipwnstudios.com/) is based on cross-compilation, rather than building GHC for android or ARM.
I just found IDEone in the Android Market, which sends your code to an online service. It works, but programming on Android isn't much fun. Btw: In case you don't want to register see BugMeNot
Surprisingly, I couldn't uncover any existing Haskell interpreter for Android.
But here are some instructions for writing your own interpreter for the Scripting Layer on Android. That's assuming you're willing to try mapping the haskell functions on top of the Java android ones (which is not a perfect solution, I know). You'll also want to refer to their scripting layer written for Scala, because that's the one that comes closest to Haskell (which is not very close I admit).
Otherwise, there shouldn't be any reason why any of those Haskell implementations couldn't be directly compiled for Android using the NDK. As long as they're written in C, they should work on Android. For C++, that's a little bit more tricky since Android doesn't have all the C++ headers.

why is Linux a base for Android devices [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have 2 questions:
Why did the Android founders choose Linux?
Is Linux the so called middleware in Android?
This seems to hold the answer:
http://android-dls.com/wiki/index.php?title=Android_FAQ#Q:_Why_does_Android_use_the_a_GPL_Linux_kernel.2C_but_libraries_and_user_space_apps_that_are_licensed_more_liberal_open_source.2Ffree_software_licenses.3F
Q: Why does Android use the a GPL Linux kernel, but libraries and user space apps that are licensed more liberal open source/free software licenses?
A: To put it simply - the Linux kernel has wide hardware and industry support, and keeping GPL code in the kernel as much as possible makes a pretty clear line between GPLed stuff and unencumbered stuff, but vendors are somewhat scared of the GPL, so it is avoided as much as possible outside the kernel. It seems that currently bluez is about the only userspace code in android which is GPLed. Official reasons for why to use a Linux kernel from a Google IO preso:
Great memory and process management
Permissions-based security model
Proven driver model
Support for shared libraries
Itʼs already open source!
For an unofficial explanation of why Google prefers the Apache2 license over the GPL license, please see this ArsTechnica article: http://arstechnica.com/news.ars/post/20071106-why-google-chose-the-apache-software-license-over-gplv2.html
I'm not sure it's possible to give an absolute answer, but the main reason for choosing Linux is probably that it's free and widely supported. Also, there's a very strong Linux community (thus a lot of know-how).
Linux is an operating system kernel, not middleware.
Linux is open source. Android needed to be.
Android uses a Linux kernel. Check out this video and the two others in the series describing Android in more detail: http://developer.android.com/videos/index.html#v=QBGfUs9mQYY
Linux was chosen because it's open and customizable enough to suit Android's needs.
Writing an entire OS is time-intensive and expensive.

Categories

Resources