Native applications. First steps


Have you ever wondered what happens to the operating system at the moment when it draws its logo and says “Starting Windows”? And in general, why does it take so long to load? After all, when the system starts, no problems that are complex from a computational point of view are solved!

What then does loading the operating system mean? For the most part, this involves mapping executable modules into memory and initializing service data structures. Data structures live in memory, so operations with them should, in theory, be fast. Everything suggests that time is consumed precisely by the process of loading executable modules into memory.

For fun, let’s figure out which modules, in what quantity and in what order are loaded when the OS starts. To find out, you can, for example, get the system boot log. The test OS in my case is Windows 7 Enterprise x64. We will log the boot process using the kernel debugger. There are several options for kernel debuggers, personally I prefer WinDbg. We will also need some aids to magically transform the log into something more pleasing to the eye.

Mining and crafting

Setting up debugging is easy to Google, so I won’t describe this process in detail. Since we are interested in everything that happens from the moment the system starts, we need to check the “Cycle Initial Break” item, with the help of which the debugger will stop as soon as the kernel debugging subsystem is loaded in the system being debugged. Duplicating the output to a file can be done using the ".logopen" and ".logclose" commands, it's simple. Other useful command- ".cls". It clears the command screen, and yes, only the command screen.

The function we are interested in is “MiCreateImageFileMap”. This internal function memory manager, which projects the executable file into memory. Memory mapping occurs when a section is created, for example, when an executable file is launched. However, please note that just because an executable file is mapped into memory does not guarantee that its code will be executed! This function simply creates a projection, most often “in reserve,” so that if someone decides to run the module for execution, it can save loading time. Let's set a logging breakpoint on this function.

If you have enough mana, enter the following command:
bu nt!MiCreateImageFileMap "dt nt!_EPROCESS -d ImageFileName @$proc; dt nt!_FILE_OBJECT -d FileName @rcx; g"
The magic line literally means the following:

  • bu (Set Unresolved Breakpoint) - set an unresolved breakpoint. It’s not that someone or something doesn’t allow it, it’s just that to install it you need to decide at what address to put it. The fact is that it is not known in advance at what address it should be located. When loading any module, the presence of required function, and if such a function is found, a breakpoint is set automatically. This installation method is indispensable when ASLR is enabled - address space randomization, since modules will be loaded at different addresses each time, and a breakpoint set at a fixed address will most likely be out of work.
  • nt!MiCreateImageFileMap is the symbol to stop at. WinDbg accepts an entry in the form "module_name!function_name". IN in this case nt is a predefined alias for ntoskrnl.exe.
  • What follows is part of the WinDbg script, which will be executed every time this function is stopped. “dt nt!_EPROCESS -d ImageFileName @$proc” in Russian means “display the ImageFileName field of the _EPROCESS structure from the nt module, provided that it is displayed at the address defined in the “current process” pseudo-register.” Next after the separator ";" the command means approximately the same thing, only the address of the structure is taken from the rcx register, in which the first parameter of the function is passed to the Microsoft x64 ABI. "g" means "go", i.e. continue execution.

A quick tip for using logging breakpoints: try not to use debugger extensions (commands starting with "!"), as this will make logging an order of magnitude slower.

Go! Release the breakpoint brake and wait. I waited until the desktop loaded, i.e. I'm logged in. The resulting “harvest” is slightly edited, all unnecessary is cut off for the convenience of further processing and fed to the python. Let's not focus on parsing the log. Let us only note that the graph fit into the shape of an Archimedes spiral with further manual correction, since the nodes overlapped each other. The resulting graph takes into account the order in which the libraries are loaded. Unfortunately, we had to sacrifice taking into account the loading order of executable files relative to libraries for the sake of readability of the graph.

Star map


Let's tentatively select several loading groups.

The OS starts working in the ntoskrnl.exe module, which is the core of the OS. And to be even more specific - from the KiSystemStartup() function. Together with downloadable system components, it forms the foundation of the OS: separation of operating modes, basic services for user applications, etc. This group also includes drivers marked for loading during system startup. In a nutshell, Windows OS is born in this shell.

The next node is the session manager. He is introduced by the first one after system process, starting in Windows - smss.exe. The process is notable for being native. Windows process, that is, it does not use the Win32 subsystem, which is generally not loaded yet. This process uses only native operating system services through ntdll.dll, which is the user mode interface to OS services. This process is also a trusted component of the operating system and has exclusive rights, for example, it can create security tokens. But its main purpose is to create sessions and initialize subsystems, both graphical and various executable ones (Windows, POSIX). This shell meets everyone's needs.

A logon group consists of several processes. In general, they are responsible for initializing sessions. This includes displaying the welcome screen, creating desktops, starting startup processes and initializing the security subsystem, etc. This broom sweeps away all strangers.

The group of services turned out to be the most massive. It owes much of its volume to the SuperFetch service. This is the one about whom they say that on weekends she pre-loads the office suite, and at the beginning of the work week - Steam with toys. Superfetch loads a huge number of modules when the system starts, so that later “everything works faster.” And besides him, the system has enough service applications and autorun drivers. I think everyone has seen the Services and Applications snap-in. This star of life brings into the system everything that is needed and not so much.

The last one I’ll mention is everyone’s favorite explorer.exe. It is noteworthy that by the time it starts, all the modules it uses are already loaded into memory. The screenshot also included a certain vcredist_x64.exe - the poor fellow was lying on the desktop of the experimental virtual machine and was loaded into memory by the conductor.

In general, there are many ways for a module to be loaded into memory. For example, it is enough to request information from the resources of the executable file, including its icon. Specifically in in this example Explorer checked whether this program requires elevated privileges, i.e. Is it worth adding a corresponding picture with a yellow-blue shield to the icon? Let me note once again that loading a module into memory does not mean executing its code!

Personally, I keep the resulting picture close by. It clearly shows dependencies, for example, of drivers. Also, paired with the Sysinternals Autoruns utility, you can see at what stage of loading certain modules are pulled up.

The download graph was built for Windows 7 Enterprise x64 installed on virtual machine VMware. Below are vector image graph and directly a file in gml format, which you can play with in any graph editor.

Someday, the lack of basic knowledge about mobile applications will probably become bad manners. In the meantime, let's talk about what kind of applications there are. Coming from afar, we can distinguish only three types: what is native app, web application and hybrid.

Do you know what a native application is?

For the user, native applications are those that require installation. In general, this is true, as is the fact that such applications are developed specifically for mobile platforms (iOS, Android, Windows Phone). Therefore, the developer is required to have programming skills in a specific development environment (xCode for iOS, eclipse for Android).

The output is pleasant appearance and seamless interaction of the application with the mobile OS. A native app is also far ahead of both a hybrid and web app when it comes to security. Such applications with the least resource consumption use the camera, microphone, accelerometer, player and other functions. Conventionally, a native application can be divided into two groups: applications that require an Internet connection, and offline applications.

Web apps are different from a native app

Using a regular website on a smartphone is inconvenient at best; at worst, the site’s layout falls apart, and after that it’s completely impossible to work with it. Web applications are created for the purpose of using a website from a phone. So, in essence, this is the same site optimized for mobile devices. Unlike a native app, web apps don't need to be installed - they run in your phone's browser. Therefore, absolutely nothing depends on the phone model (on the mobile platform, to be more precise). Also, regardless of the platform, web applications cannot work with native phone functions.

But what then is a native app compared to a mobile website? The line between a web application and a mobile site is very thin. And in this matter, it’s not just the users who are confused, but in some cases the developers themselves. But there is a difference. Conventionally speaking, the site contains more or less static information, and is something like a digital brochure. In a web application, the user can manage some part of this information - create own pages, swap links, texts, etc.

So it’s easier to call everything that is commonly called online services web applications. A web application can also be called something that was once done in Flash, and now in HTML5.

Hybrid apps

A hybrid application is called hybrid because it combines some of the functions of a native application and a web application. This is a cross-platform application that can work with phone software. These applications, just like native ones, are downloaded from the application store, but the data is updated autonomously. Therefore, they always need an Internet connection - without it, web functions do not work.

What to choose? native app, hybrid or web?

Developing a hybrid app is cheaper and faster than creating a native app. But users won’t notice the difference anyway. Therefore, hybrid technologies are the most popular. Despite all this complexity, deciding on the choice of technology for developing an application is very simple. If your application cannot work without the native functions of mobile devices, if high data processing speed is very important (games, social networks, geolocation), then nothing better can be found than a native application. When the operating speed can be neglected, it will do hybrid app. A web application should be created when the user does not need anything from you other than the information that he could get from his phone if he had the Internet.

Native applications - these are programs designed to be executed on operating systems Windows systems NT family (NT/2000/XP/2003/Vista/7), capable of starting early in Windows boot, before the login window, and even before any Windows subsystems start. Blue screen when loading Windows XP, in which, for example, the disk is checked and there is that very mode. Native applications use only the Native API, they can only use functions exported from the ntdll.dll library. WinAPI functions are not available for them.

Native applications run on the screen that appears before the login window appears. An example of a native application is the chkdsk application, which is launched before logging into Windows if the system partition was previously checked for errors and postponed until a reboot. The application runs by displaying messages on the screen, and then Windows starts normally.

Advantages of using this mode: most Windows components not yet launched, there are many restrictions missing. This mode is, for example, used in applications that want to do something with system partition Windows, but they cannot while the operating system is running: defragmenters, file system converters, and similar utilities.

Functions in ntdll.dll have prefixes Zw And Nt, as well as some others. It can be seen that the Zw and Nt functions have duplicate names. In fact, these are the same functions. If you are looking online for an example of using a function, you should search first with one prefix, then with another, otherwise you may miss something. Why they have different prefixes is a separate story; it does not play a significant role for programming native applications.

Programming requires prototypes of Native API functions, but not all definitions are present in the WDK header files. It is necessary to use alternative header files, including definitions of undocumented functions and data types. For example, you can use Native header files Development Kit(NDK), which are available.

Programming using a pure Native API is inconvenient. You can't do without a library that already implements some routine actions. There is a library with open source- You can use it. A certain NDL library was also announced on the NDK page, but it is not on the website.

For the native application to start when Windows startup, you need to put it in the system32 directory, and write its file name and arguments, if any, in the registry key HKLM\System\CurrentControlSet\Control\Session Manager\BootExecute. The key is of type MULTI_SZ and can contain several lines. The first line there is Autocheck Autochk * . After it you can write your program. The program registered in this key tends to run even in a safe environment. Windows mode (safe mode), so you need to be careful. An error in the program - and the system will not start. But you can track the fact of launching in safe mode inside the application and process this mode separately, for example, terminate the program if it detects itself running in safe mode. In addition, although the program starts and can perform some actions, console output does not work in this mode. User interaction is not possible. This should be taken into account.

If necessary, the native application can be launched without restarting the computer. To do this, use the nrun.exe utility. But this will not cause the loading screen to appear, and you will have to figure out how else to interact with your application if interactivity is needed. IN source code nrun you can see how the launch of native processes is implemented using undocumented Native API functions.

For native applications, the entry point is not main or wmain, but NtProcessStartup. The PE header of the EXE file has a special field indicating the subsystem in which the application runs. For native applications this field is set special meaning, meaning that the EXE does not require a subsystem. U regular applications the value corresponding to the "Windows GUI" or "Windows console" subsystems is set. Native applications do not run in normal Windows mode. When I try to start the program, Windows displays the message "The application cannot be launched in Win32 mode."

Displaying the Cyrillic alphabet on the screen by default is not supported in this mode. There is a way to get around this limitation, however, the method is complicated and currently only works on Windows XP.

Preparing a Native application project

I created a Native application project template - a set of files that can be used as a base for developing your own Native application. The template contains a native.c file containing the entry point to the application. The remaining files are ZenWINX library files that have been modified to use the function definitions from the NDK rather than their own definition file. This allows you to use both functions of the library itself and functions of the Native API that the ZenWINX developers forgot to include in their own header file. In fact, the NDK is a more complete directory of Native API functions than the file shipped with ZenWINX. You need to compile the workpiece using the build utility from WinDDK (I use WinDDK version 1.1.6001.000). You should include the NDK header files, specifying the paths to the directory with them.

It is also possible to develop and build Native applications directly in Visual Studio, without using the WDK compiler. How to do this is written in the article

Very little time passed from the release of the first smartphones running Android OS before enthusiasts learned to run full-fledged Linux distributions on them. Today, methods for installing Linux distributions on Android devices are widely known, and the Google Play repository even contains automated systems installing and running Linux. In this article, I will try to accumulate all the accumulated experience of working with Linux on smartphones, tell you why this is needed, and show how to avoid possible pitfalls when transferring Linux to a smartphone or tablet.

For what?

At first glance it may seem strange that someone would try to run on mobile device an operating system that, in principle, is not designed to work with a small screen and without a sufficiently precise manipulator (mouse) and keyboard. However, you should not make hasty conclusions. A Linux distribution can give the owner of a smartphone quite a lot of advantages, including a set of old proven tools, such as utilities command line, advanced editors, FTP and SSH servers, network tools and application development tools. Running Linux without graphical shell on a smartphone with a hardware keyboard (Motorola Droid, for example), you can use all this quite comfortably on the go without having to leave Android itself. All tools are available at any time, and the smartphone continues to be a smartphone, allowing you to receive calls and listen to Internet radio.

The second argument for installing Linux on a smartphone is the ability to use it as a portable workstation, which can be connected to any PC and immediately access the terminal using an SSH/Telnet client or a VNC/RDesktop client. This is by definition better than flash drives with Linux installed, since there is no need, firstly, to reboot the machine, and secondly, to drive data back and forth; the results of your work will be available immediately after you disconnect your smartphone from the computer.

Finally, Linux gives the greatest benefit on tablets, the screen of which allows you to work more or less tolerably in a graphical environment, and the ability to connect a mouse and keyboard via an OTG cable generally gives the chance to turn the tablet into a full-fledged one. workstation. At the same time, there is no particular difference between installing a Linux distribution on a tablet and a smartphone.

How?

It's really easy to port Linux to Android and the Linux kernel plays a major role here. Any Linux distribution is a set of applications and libraries that run on top of the Linux kernel, and since Android itself is based on an almost unchanged Linux kernel, these applications and libraries can be run inside the Android environment without any problems. You just need to find a distribution for which there is a port to the ARM platform (don’t forget that 99% of all Android devices run on ARM), install it using an ARM emulator on a virtual hard disk (that is, to a file), drop this file on SD card of the device, open a terminal, mount the image as a loopback device and chroot it inside. All! It's as simple as running an FTP server in a chrooted environment - a simple and decades-tested method.

The only stumbling block is when you decide to launch Linux distribution inside Android is a graphical environment. While there are no difficulties in accessing the console due to the presence full-fledged emulator terminal, problems begin with graphical applications - there is no native X server for Android, and it is impossible to run a regular X server within the distribution itself due to fundamental differences in the architecture of the green robot's graphics subsystem. Despite the fact that it is based on the standard Linux Framebuffer, on top of which you can run an X server, the exclusive right to use it initially belongs to higher-level Android libraries, so you can either download a Linux distribution instead of Android (which is completely impractical) or come up with workarounds.

Checking the operation of the necessary modules

Keep in mind that support for loopback devices and ext2/ext3 file systems required to mount the image is not available in all Linux kernels installed on smartphones running Android control. You can check for support using the lsmod | grep -e loop -e ext2.

Enthusiasts got out of this situation by using a simple method of “remotely” connecting to the desktop using any VNC client available for Android. Inside the chroot environment, the Xvnc X server runs and all applications run under its control. The user just has to install the VNC client, enter local address- and voila, a full-fledged desktop appears on the screen.

The only bottleneck when using Remote Desktop is performance. Even when working locally, VNC cannot provide the proper level of power, which would be enough for smooth scrolling or moving windows without lag. It has not yet been possible to solve this problem; projects to develop a native X server that would use the Android graphics subsystem are still very crude and cannot be used to run full-fledged graphical environments. However, no one forbids using them; for example, X Server from Darkside Technologies Pty Ltd (goo.gl/ap3uD) is quite suitable for running simple software.

Initially, Linux for Android existed only as an image with already installed system, as well as explanatory instructions on how to connect and use this image. Then scripts appeared that automated the process of connecting the image and starting Linux, but they also required some brain work. Finally, in Lately installers have appeared that are available on Google Play (for example, goo.gl/RSA1j), which to some extent automate the process of launching the distribution, although, in essence, this is still the same installation guide, but interactive, with direct links to downloading images and scripts.

Alternative options

I already mentioned above that the Linux distribution may well be loaded instead of Android, thanks to which it will be possible to use Framebuffer for direct access to the video adapter and significantly speed up the operation of the graphical interface. However, doing this on a smartphone is almost pointless - Linux is unsuitable as the main system on small screens, and it will be impossible to receive calls and use the Internet. But on Linux tablet will look quite decent.

Typically, the so-called native version of the Linux distribution is installed on a device that initially runs Android as follows. An additional partition is created on the internal NAND drive of the tablet, onto which the Linux distribution is copied. The U-Boot boot loader (used by most tablets) is then configured to use this partition as the boot partition. As a result, the tablet will automatically boot into the Linux system after turning on the power.

To leave the ability to boot Android, the U-Boot bootloader is reconfigured so that the partition with the Linux system is not the main one, but serves as a “recovery partition” ( Recovery Mode), accessible by turning on the device while holding down the volume key (the same one that is used to flash the device and perform various recovery operations). This way you can get a dual-boot device: Android by default and a Linux distribution when booted into recovery mode. Recovery Mode itself remains accessible only with the help of special tools.

If the NAND memory is not enough to accommodate a full-fledged Linux system, parts of it (usually the /usr partition) are moved to an image or partition on an SD card. By the way, the ext2 partition on the memory card can also be used to install Linux running in a chroot environment.

Installing a native Linux distribution is more difficult than installing one running in a chroot environment, but it's worth it if you have a tablet and an OTG cable with which you can connect a keyboard and mouse.

Practical lesson

As I already said, only distributions ported to the ARM architecture are suitable for running Android. First of all, these are Ubuntu and Debian, and the first, for obvious reasons, is of much greater interest among robotics. You can also install Gentoo and several specialized distributions, such as Backtrack. Let's consider the most typical case, that is, installing Ubuntu using standard scheme, without using any automated installers or anything else.


First we need a hard disk image with installed distribution. You can create it yourself using the QEMU emulator, however, due to the fact that the installation procedure is absolutely standard and typical, I will not describe it, but will simply direct you to the address goo.gl/9nvBi. Here is an archive with an image on which Ubuntu 12.04 is preinstalled graphical environment LXDE (it would be unwise to run Unity/Gnome on a phone/tablet). The archive should be unpacked and the ubuntu.img file should be placed on the memory card.

Next, you need to mount the image and chroot it into the distribution environment. To do this, you need root rights, firmware with support for block loopback devices, and busybox installed (search the Market for “busybox installer”; CyanogenMod has it by default). Sequencing:

  1. Open the terminal emulator in Android (if not, you can install it from the Market Terminal Emulator) . Or we connect the smartphone/tablet to the computer and get access to the terminal with using adb: $ cd path-to-Android-SDK/platform-tools $ sudo ./ adb shell

    Do not forget that the debugging mode in this case must be enabled: “Settings -> For developers -> Android Debugging”.

  2. We get root rights:$su
  3. We create a block loopback device, connect a disk image to it and mount it:# mknod /dev/block/loop255 b 7 255 # mount -o remount,rw / # mkdir /mnt/ubuntu # mount -o loop,noatime -t ext2 \ /sdcard/ubuntu.img /mnt/ubuntu

    The contents of the image should appear in the /sdcard/ubuntu directory. Check that this is the case.

  4. We connect all the virtual file systems necessary for the distribution to work:# mount -t proc proc /mnt/ubuntu/proc # mount -t sysfs sysfs /mnt/ubuntu/sys # mount -o bind /dev /mnt/ubuntu/dev
  5. We configure it so that you can get full access to the Network from the chroot environment:# sysctl -w net.ipv4.ip_forward=1 # echo "nameserver 8.8.8.8" > /mnt/ubuntu/etc/resolv.conf # echo "nameserver 8.8.4.4" >> /mnt/ubuntu/etc/resolv.conf # echo "127.0.0.1 localhost" > /mnt/ubuntu/etc/hosts
  6. Let's go to the chroot environment:# chroot /mnt/ubuntu

Actually, this is where the installation ends. Now you can launch console software, update the system, start network services and do almost everything that can be done with a regular desktop Linux system, not forgetting, of course, that some software that directly interacts with hardware and various specialized pseudo-devices will not work. Also, do not forget that virtual FS should be unmounted after completion of work.

Now we need to install and run the Xvnc X server, which exports display and input devices using the VNC protocol. TightVNCserver is already in the presented image and is even configured, but so that you can better understand the process and be able to solve any problems that arise, I will describe in detail the process of installing and launching it.

  1. Update and install TightVNCserver:# apt-get update # apt-get install tightvncserver
  2. Create a file /root/.vnc/xstartup and write the following into it:#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid gray export XKL_XMODMAP_DISABLE=1 icewm & lxsession

    The third command is needed here to fix problems that may arise due to the physical absence of a keyboard on the device.

  3. We launch Xvnc using the vncserver wrapper with root rights:# export USER=root # vncserver -geometry 1024x800

    As a result of executing the last command, a request for a password to access the VNC server will be displayed on the screen; it is better to specify something simple like “123”. You can set virtually any resolution, but it is better if it matches the physical resolution of the device screen.

  4. Install the AndroidVNC application on your smartphone, launch it, specify the IP address and port 5901, and connect. The LXDE desktop should appear on your screen.

In order not to bother with manually entering all the commands, you can use the ubuntu.sh script located here: goo.gl/xSpK4. Just put it and the ubuntu.img image in the ubuntu directory on the SD card and run the script with the command sh ubuntu.sh, and after 5-10 seconds connect to the desktop using AndroidVNC. Keep in mind that the script mounts the image to the /data/local/mnt directory.


Installing Gentoo on an ext2 partition

So, we installed Ubuntu using an image with a file system and tricks with a loopback device and a chroot environment. This turned out to be easy to do, and with the use of scripts it is generally very easy, but what if we go further and install a more hardcore distribution, and not using images, but on a dedicated ext2 partition on the memory card? This way we can solve the problem of some firmware and kernels without support for loopback devices and, moreover, we can enjoy a normal distribution installed according to all the rules.


Let's take Gentoo as an experimental system. To install it on an ext2 partition, we need a memory card with a capacity of at least 2 GB and a rooted smartphone with busybox installed. The sequence of actions is as follows.

  1. Let's do data backup from the memory card and create an additional partition on it, with a capacity of at least two gigabytes. This can be done using any disk partitioning program, but keep in mind that if you want to continue to use the SD card for its intended purpose, then you should create a FAT32 partition at the beginning of the card, so that it becomes the first one, and an additional partition for installing the distribution should be the second one.
  2. Formatting SD card partitions:$ sudo mkfs.vfat /dev/sdc1 $ sudo mkfs.ext2 /dev/sdc2
  3. We take the phone, go to “Settings -> About phone” and look at what processor is installed. Next, go to the page goo.gl/PRfux and download stage3 for the desired architecture, for example stage3 for ARM v7 is in the current-stage3-armv7a directory.
  4. We mount the ext2 partition of the memory card on the computer and unpack the contents of the resulting archive into it:$ sudo mount /dev/sdc2 /mnt $ sudo tar -xxpf stage3-*.bz2 -C /mnt

    We immediately edit the configs and everything you need, to your taste, including editing /etc/resolv.conf according to the example from the previous section.

  5. We launch the terminal emulator (or run the “adb shell”), mount everything we need and go to chroot (almost the same as in the case of Ubuntu): # mount -o remount,rw / # mkdir /mnt/gentoo # mount /dev/ block/mmcblk0p2 /mnt/gentoo # mount -t proc proc /mnt/ubuntu/proc # mount -t sysfs sysfs /mnt/ubuntu/sys # mount -o bind /dev /mnt/ubuntu/dev # sysctl -w net. ipv4.ip_forward=1 # chroot /mnt/gentoo

Access to the desktop is done in the same way as in Ubuntu, except that now you will have to assemble a bunch of software directly on the phone :). However, you can set up an environment for cross-compilation on your computer, but this is a topic for a separate article.

Native installation

Having launched Ubuntu using a VNC server, you will notice the slowness of its operation, which is associated with the VNC protocol overhead for transmitting images “over the network”. To avoid this problem, you can install Ubuntu as the main system next to Android so that it can use the video adapter directly. Unfortunately, universal method do this does not exist. Each device is unique in its own way, including the different partition tables of the NAND memory on which it is installed, various devices and drivers for their operation.

Fortunately, the process of installing the native version of the distribution is well described for many devices in Russian-language forums, so finding instructions will not be difficult. However, it is worth immediately paying attention to several features of this type of installation:

  • Separate or main NAND partition. The Linux distribution can be installed both in a pre-created partition in NAND memory and in the main boot partition. In the first case, the firmware developer usually leaves the option to boot Android using special script or by loading the Linux distribution in recovery mode, in the second it will be installed instead of Android and to return the ability to download the robot, you will have to reflash the device again.
  • Dual boot capability. If the Linux distribution is installed on separate section, the developer can leave the option to boot Android. However, you should immediately pay attention to how this download occurs: using recovery mode or a script launched from a regular computer. Still, the second method will be inconvenient on the road.
  • Hardware support. The original Linux kernel of the Android firmware already includes everything necessary drivers, which may be needed for the operation of a full-fledged Linux system, but not all Linux firmwares will start everything by itself. Problems often arise with the Wi-Fi adapter and touch screen who reacts inappropriately to touch. Therefore, before installing the firmware, you should carefully read about possible complications.

In any case, be prepared for the fact that during the installation of the Linux distribution all your data will be destroyed. There is no way without this.

What's next

A Linux distribution installed next to the original Android system can become a very convenient working tool, but this moment“Linux inside Android” is considered more of a toy and a way to show off to friends than a serious solution. I am sure that soon, when a full-fledged implementation of the Wayland graphical server appears for Android, the situation will begin to change and we will see distributions with an interface adapted for small screens, as well as full-fledged Linux applications distributed in the form of regular APK packages. Also, don’t forget about the “Ubuntu for Android” project - within its framework, work is underway on an official port of Ubuntu for Android, which will allow you to use your smartphone as a portable system unit connected to any monitor.

UEFI boot is a new generation program that will speed up booting your computer and is similar in structure to BIOS.

– this is a pre-program (code embedded into the computer’s motherboard). It runs before the operating system boots, checking the functionality of the computer and debugging the hardware (drivers). UEFI, unlike the usual BIOS, is GUI, flexibly programmed and really allows you to launch the OS faster.

The preprogram is located on top of the entire hardware of the computer, and its code, which is significantly larger than the BIOS in size, can physically be located anywhere - in a memory chip on the motherboard, on the hard drive, or in network storage. Thanks to this, it resembles an operating system, only in a simplified version. When the computer starts, the UEFI service first loads, checking all the components of the latter, and then the operating system itself.

Benefits of UEFI

    • OS loading acceleration;
    • Russian language support;
    • no problems using hard drives large volume (2 TB and above);
    • supporting multi-launch operating systems, their proper organization;
    • visual monitoring of the condition of PC parts;
    • convenient and human-friendly visual interface;
    • The program microcode contains greater protection against viruses than the BIOS;
    • like full-fledged operating systems, it has its own software and network storage.

Concerning UEFI Secure Boot, then this is a pre-provided method for protecting against the launch of unlicensed code by the developers. He doesn't allow virus programs replace the bootloader, and if using Microsoft- saves from pirated version OS. However, most often this mode is disabled by default, or for some reason users have to disable it themselves.

Currently, UEFI is presented as a separate part of the standard BIOS, but computers with motherboards are already being produced where the opposite is true - the BIOS is considered an additional module to UEFI.

  • Ability to support GPT markup;

GPT partitioning was created specifically to make it less problematic to work with disks of 2 TB or larger. In addition, when setting up the operating system for the first time, you can split the disk into any number of partitions, which was previously impossible. The previous partitioning method - MBR is not compatible with uefi and working with it is only possible if you have additional expansion CSM (Compatibility Support Module).

  • Modular architecture;

The shell module (not available on all laptops) “allows” the user to manage applications directly in UEFI mode. As mentioned, UEFI is like an operating system in its own right, even with support network drivers. The specification of the program “allows” the use of drivers for UEFI using the OS, for example, if the main operating system does not have a network driver or does not work.

  • Built-in boot manager;

If you plan to multiboot, you do not have to install a specialized boot manager. You can independently add new sections to the menu, where the list of all disks and flash drives is located. Thus, it is possible to run the Linux kernel without using a bootloader or install both Windows and Linux on one device.

Secure Boot does not cancel this option for Windows users 8. On all devices it is possible to disable this mode, except for tablets on ARM, where Win 8 was installed as the standard OS. Protected mode prevents the use of unsigned code even while the operating system is running, so malicious Trojans will not penetrate either Windows or Linux. However, if the attacker has physical access to a PC, he can almost always replace the license keys with his own.

Using UEFI to boot an operating system from a USB drive

Execution order:

  • Go to the BIOS and in the Secure Boot item select Disable.

  • In the OS Mode Selection item, select Uefi and Legacy boot (allow boot).

  • After this, you can restart the BIOS - booting from USB is activated.

Fundamentally different from installing via UEFI. The first step is to create a bootable USB flash drive. One of the most suitable programs for such purposes is the Rufus 1.4.6 utility. It is free, does not require installation and therefore does not take up much space on your hard drive or removable media. What is important is that it is suitable for GPT hard disk partitioning and can work with the UEFI specification. The appropriate utility update can be downloaded from the official website of the developers.

We launch the utility and indicate the name of the flash drive intended for installation (you must first delete important files by clearing the memory). In the “File system” item, select FAT 32, then GPT (GUID Partition Table) as the partition scheme, system interface– UEFI. Check the box next to “Create a bootable disk using:”, select ISO Image next to it and specify the full path to the ISO image of the Windows operating system.

After entering all the described parameters, you can click on “Start” and the program will independently prepare the flash drive for loading the OS. The time taken for this process depends on the speed of your computer and the USB generation.

If you are not satisfied with the operation of the Rufus utility or have problems loading UEFI, you can use an absolutely similar program called WinSetupFromUSB.

Downloading is also available on the manufacturer’s website, and its name (translated as “Boot Windows from USB”) speaks for itself. A bootable flash drive is created in a completely similar way, since the programs have almost the same interface.

Booting UEFI and preparing for installation

UEFI setup is carried out similarly. Restart your PC, and once it starts to boot, press F2 (or Delete, depending on what you have installed motherboard, can only be verified experimentally). The control menu will open.

Press the F7 button and select the “Advanced” subsection. In the “boot” or “startup” tab, you need to select the “USB support” function and set the “Full initialization” item there.

In the “Secure Boot” tab, check the “Windows uefi mode” item ( Windows mode UEFI).

In the “Download” tab, select “Compatibility Support Module” and mark it as “enabled”. It wouldn’t hurt to click on additional links and find the line “settings boot devices", where select "only uefi" (only uefi).

This precaution protects against the accidental use of media that does not support your specification. In the entry “booting from media (or storage devices)” you need to check “both, uefi first” (both, but uefi first).

Now go back to the main menu and check the boot device priority. First, the flash drive is selected, then the hard drive. Save specified parameters by pressing the F10 button, then Enter and wait until the computer boots.

After completing all of the above, you can install the operating system in the usual way.

Troubleshooting an error that occurs in Windows 8.1

If, after installing Windows or after updating version to 8.1, a notification appears in the right corner of the monitor about incorrect secure boot adjustment.

On most computers, the problem can be solved by going to the uefi menu and turning on the “Secure boot” mode in the BIOS.

In the event that yours does not have an option to enable/disable secure boot, you need to download it from the official web page Microsoft update for version 8.1. It is located there under the number KV 2902864 and is valid for both 32-bit and 64-bit systems.

After downloading and installing the update, your computer will restart and error notifications will no longer appear.

How to disable UEFI

If you do not have Windows 7-8-10, but XP or Ubuntu, UEFI mode may cause problems when starting the OS from a disk or flash card. The best solution would be to disable this mode.

UEFI disabling algorithm:

  • Go to the computer's BIOS. If you plan to disable UEFI in Windows 8 or 8.1, you can click on “Restart” in the Start menu and select additional options"UEFI Software Settings". This is the most convenient option - the laptop will start in the required settings.

If the operating system version is not suitable, enter the BIOS using F2 or Delete, as suggested above. There may be other key options, most often desired button indicated below home screen when you turn on the PC.

  • Open the Boot tab, then Secure Boot and find the OS Type sub-item. There you need to specify “Other OS” (other OS) and save the settings by pressing the F10 key. Sometimes you may need to additionally disable the parameter safe start(“disabled” position).

The described instructions are intended for ASUS brand laptops, but for other brands the algorithm is the same, the difference is which key needs to be pressed when starting the computer.

This option is suitable for the eighth and tenth Windows versions. Press the Windows + R buttons and in the resulting window, enter the command “msinfo32” (without quotes). Press the Enter button.

In the window that appears, select the “System Information” section on the left, and find the “Secure Boot Status” line on the right. The Value column shows whether the feature in question is enabled or disabled.

Additional Information

  • The utility, updated to the second version, supports 32-bit platforms, although it was created for 64-bit ones.
  • The functionality looks like tables of values ​​about the state of computer components, boot services and the so-called runtime - a set of tools for working with the OS.
  • EFI extensions are also installed from non-volatile sources - from a flash drive or removable HDD.
  • For "machines" with pre-installed Windows 8, there may be difficulties with the transition to Linux - their distributions must have signed (certified) crypto keys from the manufacturer.






2024 gtavrl.ru.