LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   Any known way to use lilo to boot Android? (https://www.linuxquestions.org/questions/general-10/any-known-way-to-use-lilo-to-boot-android-4175580961/)

stf92 05-29-2016 09:06 AM

Any known way to use lilo to boot Android?
 
That's basically the question. The Android installer (Android 4.4.2) writes a grub.cfg which is this:
Code:

default=0
timeout=6
splashimage=/grub/android-x86.xpm.gz
root (hd0,6)

title Android-x86 4.4-r2
        kernel /android-4.4-r2/kernel quiet root=/dev/ram0 androidboot.hardware=android_x86 SRC=/android-4.4-r2
        initrd /android-4.4-r2/initrd.img

Perhaps this can be "translated" into a lilo.conf file. I reckon this is a difficult question, as nowadays nobody seems to be using lilo.

hazel 05-29-2016 09:50 AM

LILO stands for "Linux Loader" and that's a good description of what it is. It can only boot Linux. Well, that's not quite true; lilo comes with a chainloader which it can also boot, and which can then boot early versions of Windows, but nobody uses those now. Lilo can't boot a modern NTFS-based Windows and I doubt if it could boot Android either.

GRUB stands for "Grand Unified Bootloader" and again, it's a good description. Grub can boot just about anything. That's why everybody uses it now. Personally I hate grub because it's so complicated. I use lilo whenever I can; it's just as good as grub on a pure Linux system and much easier to understand. But grub wins hands down on a mixed (multiboot) system.

It's not true that nobody uses lilo. Crux uses it and Slackware was using it too when I last looked.

stf92 05-29-2016 07:45 PM

[GO TO the final paragraph where the real question is if you like.]

I tried Didier's link to no avail. Then I went on reading the grub info file. And this is what I've done, having been rewarded by success.

(a) I installed Android 4.4.2 in partition 7. Mount it on /media.
(b) I created a small partition[, partition 8. Mount it on /mnt/boot.
(c) > mkdir /mnt/boot/android-4.4-r2
> cp /media/android-4.4-r2/* /mnt/boot/android-4.4-r2
> cp -r /media/grub /mnt/boot
(d) Crear /mnt/boot/grub/grub.cfg con vim con el siguiente contenido:

default=0
timeout=6

menuentry "Android KitKat" {
set root='(hd0, 7)'
linux /android-4.4-r2/kernel quiet root=/dev/ram0
androidboot.hardware=android_x86 SRC=/android-4.4-r2
initrd /android-4.4-r2/initrd.img
}

hd0 is sda, hd1 is sdb and so on. 7 is the 7th partition.

(e) > grub-install --boot-directory=/mnt/boot /dev/sda
(f) Reboot
(g) End of procedure.

You can choose to let the OS installer to create a grub.cfg to
see how it looks. It's pretty much like that listed above,
but it had (hd0, 6) instead of (hd0, 7) [????]

I wanted to make it simple, so I did not installed slackware.

Now, I guess the grub.cfg file for Slackware 14.1 won't be much different but, just in case, I would like somebody to guide me in the process if you don't mind. The lilo.conf I use is (essentially):
Code:

boot = /dev/sda
image = /boot/vmlinuz
  initrd = /boot/initrd.gz
  root = /dev/sda5
  label = 14-32
  read-only  # Partitions should be mounted read-only for checking


yancek 05-30-2016 08:17 AM

The Grub entry in your initial post is in the format used by Grub Legacy while the entry in your last post is in Grub2 Format. They are not interchangeable. Your comment about "(hd0,6) instead of (hd0,7) is one difference between Grub Legacy and Grub2. Grub Legacy counts drives and partitions from zero while Grub2 counts drives from zero and partitions from one. So in Grub Legacy, sda7 is equal to (hd0,6) and in Grub to it is equal to (hd0,7).

I'm not sure what your question is, but if you want to boot Slackware on sda5 from the Grub2 in Android, the entry below should chainload to Slackware. Not enough info to give a direct boot entry.

Quote:

menuentry 'CHAINLOAD Slackware' {
insmod ext2
set root=(hd0,5)
chainloader +1
}
Quote:

Lilo can't boot a modern NTFS-based Windows and I doubt if it could boot Android either.
I installed the 32bit version (non-UEFI) of windows 10 several weeks ago and put the entry below in lilo.conf on Slackware which chainloaded to boot windows 10.

Quote:

other = /dev/sda3
label = windows-10

stf92 05-30-2016 01:50 PM

Two things, then: can't Android be booted by LILO? Consider 4.4.2 is a deprecated version, I mean, perhaps it not being so modern, it can. One, and the other: in case it can't, I gave the exact entry I have in lilo.conf to boot Slackware. Anything else you need (I'd like to boot Slackware directly from the initial bootloader)?

gnashley 05-31-2016 01:51 AM

I see no problem with booting android using lilo -what's getting booted is linux, after all.

stf92 05-31-2016 04:04 PM

That is exactly what I thought. The grub.cfg is
Code:

#menuentry "Android KitKat" {
#    set root='(hd0, 7)'
#    linux /android-4.4-r2/kernel quiet root=/dev/ram0
#    androidboot.hardware=android_x86 SRC=/android-4.4-r2
#    initrd /android-4.4-r2/initrd.img
#    }

I translated it, for lilo, in the following way:
Code:

image = /mnt/android-4.4-r2/kernel
  append="quiet root=/dev/ram0 androidboot.hardware=android_x86 SRC=/mnt/android-4.4-r2"
  initrd = /mnt/android-4.4-r2/initrd.img
  root= /dev/sda7
  label = "Android KitKat"
  read-only

However, after the CPU begins running the kernel, it says "Detecting Android ......." and fills the screen with periods and never ends. I must be doing something wrong.

yancek 05-31-2016 08:03 PM

The link below to another post here at LQ has an entry in lilo.conf to boot Ubuntu which, according to the post, does boot.

http://www.linuxquestions.org/questi...ubuntu-613632/

I downloaded and isntalled Android and tried to boot with an entry similar to this post and got the same result you did. I reinstalled it and installed Grub Legacy on Android and ran lilo again from Slackware. I got a message in the lilo output indicating the boot sector had a problem (didn't write it down so don't remember it exactly). The basics of it was that Grub was not installed correctly. Since Android by default uses Grub Legacy, I reinstalled Grub Legacy from another Linux system and then put the entry below in lilo.conf, re-ran lilo and booted it sucessfully from the Slackware Lilo boot menu. The problem I had was that Android did not install Grub correctly.

Code:

other = /dev/sdb10
label = android

The entry above is basically a chainload entry and a bootloader needs to be in the correct place on the partition for it to work. I would expect your entry or something similar to work and don't really know why it didn't.

Hungry ghost 05-31-2016 09:15 PM

In case this helps, this is the custom file (for grub) I used to boot Android-x86 when I had it installed on my PC (it worked fine in my case):

Code:

menuentry "Android 4.4" {
set root=(hd0,6)
search --fs-uuid --set 26775fde-d522-4dd8-8d40-933b10c083a3
linux /android-4.4-r2/kernel quiet root=/dev/ram0 androidboot.hardware=android_x86 SRC=/android-4.4-r2 DATA= video=-16
initrd /android-4.4-r2/initrd.img
}

Maybe you need to use lilo's equivalent to the "search" command above and use the partition's UUID?

stf92 06-03-2016 02:56 PM

Quote:

Originally Posted by yancek (Post 5553747)
The entry above is basically a chainload entry and a bootloader needs to be in the correct place on the partition for it to work.

I remember that DOS had, in the first sector of each partition, a set of data belonging to the partition, the Bios Parameter Table, and executable code. This, then, would be a bootloader? And when you put boot=/dev/sdaN in lilo.conf, that would put the lilo bootloader in the first sector of partition N?

I installed Android in partition 7 and told it to install the Grub bootloader. I suppose it put it in the first disk sector. Anyways it wrote a menu.lst. Then I booted in linux, and mounted /dev/sda7 on /mnt/boot, with menu.lst renamed to grub.cfg and issued the following command:
Code:

root@server:~# grub-install --boot-directory=/mnt/boot /dev/sda7
/usr/sbin/grub-bios-setup: warning: File system `ext2' doesn't support embedding.
/usr/sbin/grub-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-bios-setup: error: will not proceed with blocklists.
root@server:~#

Then I repeated the procedure but telling Android to format in ext3. I thought I had an ext3 fs now but to my surprise I found I still had ext2. Well, this I should ask in an Android forum, but my proceeding, puting /dev/sda7 instead of /dev/sda in the grub-install command line was right, isn't it?

yancek 06-03-2016 04:54 PM

Installing a bootloader to a partition installs some code to a specific location/sector of the partition.

Quote:

And when you put boot=/dev/sdaN in lilo.conf, that would put the lilo bootloader in the first sector of partition
That tells you where the Lilo code is, the partition. An explanation of the parameters for Lilo at the link below.

http://www.control-escape.com/linux/lilo-cfg.html

The image line in Lilo should tell the Lilo bootloader on your Slackware partition where to look (which partition) for the kernel on the android partition.

I'm not sure why you changed the name of the menu.lst file to grub.cfg? menu.lst or grub.conf are the default names for the Grub Legacy boot menu file, what you see on-screen when you boot. grub.cfg does the same for Grub2.

If you installed Grub in Android, did you try booting with the lilo entry I suggested above, the 'other' entry? If Grub installed to your android partition, it should chainload from Lilo.

Quote:

other = /dev/sda7
label = android
Quote:

root@server:~# grub-install --boot-directory=/mnt/boot /dev/sda7
In order for the command above to be successful, you would first need to create a boot directory in Android which it does not do in a default install. Mounting android at /mnt/boot you would then need the path to be: /mnt/boot/android-4.4-r2/boot

Are you now trying to install Grub2 to the Android partition and forgetting about booting it from Lilo?

The Grub2 entries I have on various distributions all have the 'insmod ext2' entry even though the filesystems are ext4 so I wouldn't worry about it.

Android installs Grub Legacy by default and you are trying to install Grub2 so you need to decide which to use, either should work but Grub Legacy is simpler to install. Good luck with it.

patrick295767 06-05-2016 10:35 AM

why not using Syslinux?

stf92 06-05-2016 05:44 PM

Well, a friend of mine, who does not know anything about computers, has Android 4.4.2 on it's tablet. I wanted to install that OS in my notebook to get familiar with it and be able to help my friend. So, anotther OS won't do.

yancek 06-05-2016 06:51 PM

Quote:

I wanted to install that OS in my notebook to get familiar with it and be able to help my friend. So, anotther OS won't do.
If you are referring to the suggestion above to use 'Syslinux', it is another bootloader and not an operating system. Syslinux is used on most CD/DVD and installation media to boot them.

If you have the default Grub Legacy installed to the boot sector of the android partition, the 'other' entry I posted above should work. At least it worked on my system.

stf92 06-06-2016 06:57 PM

So the installer when it runs the grub program writes the bootloader not to the MBR but to the same partition I chose?


All times are GMT -5. The time now is 07:59 PM.