강몬드의 프로그래밍 이야기

안드로이드는 리눅스 기반이다?! 본문

프로그래밍/안드로이드

안드로이드는 리눅스 기반이다?!

강몬드 2015. 6. 18. 12:56

안드로이드는 리눅스 기반이다?!


안드로이드 관련 공부를 하다가 흥미로운 내용이 있어서 작성했습니다. 원문은 아래에 첨부합니다. 


안드로이드는 이제 우리에게 익숙한 단어인데요. 
이 안드로이드는 애플 제품 이외에 대부분의 핸드폰의 운영체제(Operating System:OS)라고도 할 수 있습니다. 

그럼, 데스크탑의 운영체제와는 어떻게 다를까요?? 흔히 아시기를, 안드로이드는 리눅스 기반으로 설계된 운영체제로 생각할 겁니다.
(똑똑하신 분은 둘의 차이를 아시겠지만, 필자는 그랬습니다.) 

과연, 안드로이드는 리눅스 기반으로 설계된 운영체제일까요?! 궁금해서 구글을 통해 찾아본 내용을 공유합니다. 



1. Android is Based on Linux, But What Does That Mean?


안드로이드는 리눅스 기반이지만, 데스크탑에서 사용된 리눅스 시스템의 형태 기반은 아니다. 리눅스 데스크탑용 배포판 운영체제에서 안드로이드 앱( Application: App)을 실행할 수 없고, 리눅스 프로그램들 또한 안드로이드에서 사용할 수 없다. 

리눅스는 안드로이드의 핵심 요소이지만, 안드로이드를 개발한 구글은 리눅스에서 사용되는 모든 소프트웨어(Software:SW)와 라이브러리를 안드로이드에 추가하지는 않았다. 위 같은 결과가 많은 차이를 만든다. 

2. “Linux” vs. The Linux Kernel


안드로이드와 리눅스의 차이가 리눅스가 의미하는 바이다. 사람들이 말하는 "리눅스"라는 단어는 여러가지 의미로 사용되어진다. 보통의 경우엔, 리눅스는 리눅스 커널을 의미한다. 그리고 커널은 운영체제의 핵심 요소이다.  

우리는 리눅스 배포판도 간단하게 "리눅스"라고 생각한다. 그러나, 리눅스 배포판은 리눅스 커널이 아니다. 리눅스 배포판은 사용자의 편의를 위해 다양한 소프트웨어(GNU shell utilities, Xorg graphical server, GNOME desktop, Firefox web browser, 등등)를 포함하고 있다. Ubuntu, Mint, Debian, Fedora, Arch, openSUSE, 등등의 것들을 "리눅스 배포판"이라고 한다.

안드로이드는 리눅스 커널을 사용하고 있다. 리눅스 커널은 오픈 소스(open source)이고, 구글의 안드로이드 개발자들이 리눅스 커널을 본인들의 필요에 따라 수정할 수 있다. 

이 글을 읽는 사람이 안드로이드 기기를 쓰고 있다면, 지금 바로 리눅스 커널 버전을 확인할 수 있다.
본인의 모바일이나 태블릿 내의 안드로이드 환경설정 화면에서 리눅스 커널 버전을 확인하면 된다.

3. The Differences


안드로이드는 일반적인 "리눅스 배포판"에서 사용되는 많은 소프트웨어를 포함하지는 않지만, 리눅스 커널을 사용하고 다른 소프트웨어를 사용한다. 이게 바로 안드로이드와 리눅스의 차이이다. 

안드로이드 장치를 부팅할 때, 리눅스 배포판처럼 리눅스 커널이 실행이 된다. 그러나 안드로이드는 일반적인 리눅스 배포판에서 사용하는 GNU C 라이브러리(glibc)를 사용하지 않고, 리눅스 GNU 라이브러리들 또한 사용하지 않는다. 또한, Xorg와 같은 X 서버도 없어서 리눅스 어플리케이션도 실행할 수 없다.

즉, 일반적으로 리눅스에서 어플리케이션을 실행하는 것과 달리, 안드로이드는 달빅 가상 머신을 통해 자바 프로그래밍 언어로 개발된 어플리케이션들을 실행한다. 즉, 이 어플리케이션들은 안드로이드 장치에 구체화돼있다. 

4. Why You Can’t Run Desktop Linux Software on Android


안드로이드는 리눅스에서 사용하는 X server나 GNU 라이브러리 또한 없기 때문에 리눅스 용 어플리케이션은 안드로이드에서 실행할 수 없다. 그래서 안드로이드에 구체화된 어플리케이션을 실행해야 한다. 

안드로이드에서 리눅스에서 볼 수 있는 shell을 설치할 수 있다. 이 shell을 안드로이드에서 사용하려면, "Android Terminal Emulator"라는 어플리케이션을 설치하고 터미널 환경을 사용할 수 있다.

이처럼 안드로이드에서는 제한적인 환경이기 때문에, 터미널을 사용해서도 할 수 있는게 많지는 않다. 리눅스 배포판 터미널 창에서 루트 권한을 얻는 건 로그인 정보 알면 쉽게 얻을 수 있다. 그러나 안드로이드에선 이 또한 쉽지가 않다. 디바이스 루팅 작업 없이는 루트 권한을 얻을 수 없다. 터미널 창에서 실행하려는 대부분의 명령어들은 사용할 수 없다. - 그래서 사람들이 안드로이드 기기에서 루팅을 하려고 하나보다.- 


5. Why You Can’t Run Android Software on Desktop Linux


반대로, 리눅스는 안드로이드와 달리 달빅 가상 머신이 없다. 그래서 짐작하건대로 리눅스에서는 안드로이드 어플리케이션을 실행할 수 없다. 달빅 가상 머신을 포함해서 다른 안드로이드 소프트웨어들을 리눅스에 올리는건 쉽지 않다. 이론적으로는, 경험이 충분한 개발자들이 리눅스 데스크탑에 달빅을 설치하고 안드로이드 어플리케이션을 실행한다. 리눅스 배포판 중 하나인 Ubuntu에서 안드로이드를 위해 잠정적으로 위와 같은 개발을 진행 중이다.

다른 방법으로는 블루스택(BlueStacks)을 비롯한 안드로이드 앱 에뮬레이터들이 가상 머신 내의 가상 하드웨어에서 안드로이드를 사용한다. 성능의 한계가 존재해서 별로 좋은 방법은 아니다. 

구글 크롬 운영체제 또한 리눅스 기반이다. 안드로이드 처럼, 크롬 운영체제는 X 윈도우 시스템을 제공하지 않아서 리눅스 용 어플리케이션을 실행할 수 없다. 그러나 안드로이드와 다르게 크롬 운영체제는 리눅스 배포판과 유사하기도 한데, 개발자 모드로서 리눅스 배포판용 소트프웨어를 설치할 수 있다.

- 원문은 아래에 있습니다. 


Android may be based on Linux, but it’s not based on the type of Linux system you may have used on your PC. You can’t run Android apps on typical Linux distributions and you can’t run the Linux programs you’re familiar with on Android.

Linux makes up the core part of Android, but Google hasn’t added all the typical software and libraries you’d find on a Linux distribution like Ubuntu. This makes all the difference.

“Linux” vs. The Linux Kernel


The big difference here comes down to what we mean by Linux. People use the term “Linux” to mean many different things. At its most basic, Linux means the Linux kernel. A kernel is the core part of any operating system.

We also refer to Linux distributions as simply “Linux.” However, Linux distributions aren’t just the Linux kernel. They contain many other pieces of software, such as the GNU shell utilities, Xorg graphical server, GNOME desktop, Firefox web browser, and so on. That’s why some people think the term GNU/Linux should be used for “Linux distributions” like Ubuntu, Mint, Debian, Fedora, Arch, openSUSE, and others.

Android uses the Linux kernel under the hood. Because Linux is open-source, Google’s Android developers could modify the Linux kernel to fit their needs. Linux gives the Android developers a pre-built, already maintained operating system kernel to start with so they don’t have to write their own kernel. This is the way many different devices are built — for example, the PlayStation 4 uses the open-source FreeBSD kernel, while the Xbox One uses the Windows NT kernel found in modern versions of Windows.

You’ll even see the Linux kernel version running on your device under About phone or About tablet in Android’s Settings.

The Differences


There’s some debate over whether Android qualifies as a “Linux distribution.” It uses the Linux kernel and other software, but it doesn’t include much of the software Linux distributions normally include.

When you boot an Android device, the Linux kernel loads just like it would on a Linux distribution. However, much of the other software is different. Android doesn’t include the GNU C Library (glibc) used on standard Linux distributions, nor does it include all of the GNU libraries you’d find on a typical Linux distribution. It also doesn’t include an X server like Xorg, so you can’t run standard graphical Linux applications.

Rather than running typical Linux applications, Android uses the Dalvik virtual machine to essentially run applications written in Java. These applications are targeted at Android devices and the application programming interfaces (APIs) Android provides rather than being targeted at Linux in general.

Why You Can’t Run Desktop Linux Software on Android


Because Android doesn’t include a graphical X server or all the standard GNU libraries, you can’t simply run Linux applications on Android. You have to run applications written specifically for Android.

Android does have a shell like the one you’ll find on Linux. There’s no way to access it out-of-the-box, but you can install an app like Android Terminal Emulator to gain access to this terminal environment.

By default, there’s not much you can do here. The terminal will still run in a restricted environment, so you can’t gain a full root shell without rooting your Android device. Many standard commands you might need aren’t available — that’s why people who root their device generally install the BusyBox application, which installs many command-line utilities. These utilities are used by applications to do things with their root access.

Why You Can’t Run Android Software on Desktop Linux


Linux doesn’t include the Dalvik virtual machine, so it can’t run Android apps. The Dalvik virtual machine and all of Android’s other software can’t simply be dropped onto a desktop Linux machine — you’d have to do more work to make Android apps output to a window on a standard desktop through Xorg, for example. Theoretically, with enough work, developers could make Dalvik run on desktop Linux so desktop Linux users could run Android apps on their desktops. The now-dormant Ubuntu for Android product attempted to do something like this, integrating Ubuntu and Android on a phone and allowing those Android apps to run on Ubuntu’s desktop.

BlueStacks and other Android app emulators attempt to do this for Windows and Mac. They run Android on virtual hardware in a virtual machine, allowing them to run Android apps — with a performance penalty — on your desktop. These solutions haven’t proven very popular, though.

Google’s Chrome OS is also based on Linux. Like Android, Chrome OS doesn’t provide a standard X window system, so standard Linux applications can’t run on Chrome OS. Unlike Android, Chrome OS is closer to standard desktop Linux distributions so you can use developer mode to install the missing Linux desktop software.




'프로그래밍 > 안드로이드' 카테고리의 다른 글

System.load() 와 System.loadlibrary() 차이점  (0) 2015.04.30
Comments