Project

General

Profile

Olinuxino Lime2 Bootloader

infinite_recursion - over 3 years ago -

I'm installing Parabola on Olinuxino Lime2. From my x86_64 parabola system, I'm installing it on microSD card. I installed package uboot4extlinux-a20-olinuxino-lime2. Partitioning is as follows:

Total 32GB
256MB FAT32 sdb1 (booting partition)
512MB swap
rest ext4

In the installation guide, there's the following statement:

However merely installing the package isn't sufficent to make the device boot from that bootloader. You then need to put the bootloader in a special location so it's picked up by the hardware

  1. I'm confused what that special location is. Is it the sd card partition?
  2. What does u-boot search for on bootup? Does it Look for a boot flagged partition? Or a specific directory's file?

Except bootloader, I think I'm done. Also, it would be great if there would be iso images which can be flashed directly. I can contribute 1 for olinuxino lime2 once done.


Replies (14)

Olinuxino Lime2 Bootloader - bill-auger - over 3 years ago -

an ISO is a bootable image, such as for CDs - most ARM boards
can not boot from the type of storage for which ISO are designed
- there is a tarball release for ARMv7 on the downloads page -
one only needs to explode the tarball onto a partition which will
be the system root dir / - its not really any more convenent than
pacstrap; only a bit faster

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

I don't get it. This does not answer my question. I initially tried to dd the img file as it is on sd card if that's what you're suggesting. Didn't work.

I'm asking what to do on lime2 after installing uboot4extlinux-a20-olinuxino-lime2 package in the above scenario

RE: Olinuxino Lime2 Bootloader - bill-auger - over 3 years ago -

that is not what i suggested - the .img file on the downloads
page is for use in QEMU - i was referring to the .tar.gz file;
and not using the `dd` command; but `tar`

it is explained in section 10 of the ARM install guide

https://wiki.parabola.nu/ARM_Installation_Guide#rootfs_installation

RE: Olinuxino Lime2 Bootloader - GNUtoo - over 3 years ago -

I've updated the manual to try to be more clear on that.

On x86 with a BIOS, the BIOS loads GRUB from the offset 0x0 on the hard disk or SSD.

Wikipedia has more details on that here: https://en.wikipedia.org/wiki/Master_boot_record

Basically at the first 512k of the hard disk, the MBR stores data and code:
  • There is some data named 'partition table' for defining the number of partitions and where they are located on disk.
  • There is also some space for some code. This is where the first stage of GRUB is installed.

On the ARM computers supported by Parabola, there is no BIOS.

Instead there is a bootrom: it's some code that initialize some of the hardware and fetch the bootloader from a storage device.

Like with the BIOS and the MBR, the bootrom expects the first stage of the bootloader to be at specific locations. It also supports other ways of booting that we don't support yet in Parabola.

So while on x86 you have to use grub-install, here we have no u-boot-install yet, so instead while installing u-boot you are asked if you want to install it and/or you are given commands (to adapt) to do it.

While it would be a good idea to create some u-boot-install script or program, I didn't have the time to do it yet as I'm involved in too much free software projects at once.

Though it could be a good idea for people that have more time than me to try to do it.

Denis.

RE: Olinuxino Lime2 Bootloader - GNUtoo - over 3 years ago -

So from here you could try to follow again what is in
https://wiki.parabola.nu/ARM_Installation_Guide#Installing_the_bootloader
to install the bootloader.

More precisely, after having re-mounted the partitions in /mnt, you can follow that part:

# arch-chroot /mnt
# pacman -S uboot4extlinux-a20-olinuxino-lime2

Packages (1) uboot4extlinux-a20-olinuxino-lime2-2017.01-1.1

Total Download Size:   0.20 MiB
Total Installed Size:  0.53 MiB

:: Proceed with installation? [Y/n] 
[...]

At the end of the package installation, it will either ask you if you want to install the bootloader or give you commands to do it. If it asks you to install the bootloader, it might look like that:

A new U-Boot version needs to be flashed onto /dev/mmcblk0.
Do you want to do this now? [y|N]

If your microSD is available at /dev/mmcblk0, you can safely say 'y'.

If not it will give you commands that you'd have to adjust to install the bootloader (at the right location) on the microSD. In this case, the command will look like that:

  "dd if=/boot/u-boot/images/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8" 

Here if your microSD is on /dev/sdc instead of /dev/mmcblk0 for instance, you'll just need to change /dev/mmcblk0 with /dev/sdc instead.

Denis.

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

Thanks GNUtoo.

In the past, I've used dd to flash an img file completely as it is to the SD card. Here, we're installing parabola on /dev/sdc before this dd . So won't it overwrite installed parabola's files? I saw in man that dd is used to convert and copy files. What does the command do in this case?

RE: Olinuxino Lime2 Bootloader - GNUtoo - over 3 years ago -

So won't it overwrite installed parabola's files

It could in some cases. I need to check if the installation guide covers that or not.

To understand that we need to look at the dd command:

dd if=/boot/u-boot/images/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8" 

Given that:
  • An MBR is 512 bytes (I made a mistake earlier, it's 512 bytes not kilobytes).
  • f-disk will start the first partition at 1024k unless you set the start of the partition in sectors manually.
With a classical MBR we would have:
component size start end
MBR 512 bytes 0 512 bytes (0.1 k)
u-boot-sunxi-with-spl.bin 512k 4k 516k
First partition N/A 1024k N/A

So here it would always work as long as we don't manually force the first partition to start earlier.

The 1024k gap at the beginning is also there for performances reasons: not having that gap could slow down a lot read and writes as it would result in data not aligned on the disk, so you could need 2 read instead of one to read a filesystem block. This may also lead to write amplifications. As in some cases users (like me for instance) have several layers on top like LVM, LUKS, etc, this could degrade even more the performances if it's not aligned.

Because of that most applications that create partitions (like fdisk, gparted, etc) put a gap at the begining.

I'll check for the GPT later on.

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

My sdb1 partition was empty (256MB) . I executed the dd command. Hopefully, it didn't overwrite anything. Now the final problem is of extlinux.conf . This is the 4th line.

append console=ttyS0,115200 root=/dev/mmcblk0p1 rw rootwait

So the device will be different once I boot on lime2, it won't be /dev/sdb . What would the configuration be for that?

There's no file named /dev/mapper/vg-rootfs as shown in guide code below. Also what is n8 there?

append console=ttyS0,115200n8 quiet rw root=/dev/mapper/vg-rootfs

RE: Olinuxino Lime2 Bootloader - bill-auger - over 3 years ago -

So the device will be different once I boot on lime2,
it won't be /dev/sdb . What would the configuration be for that?

the root filesystem device will be /dev/mmcblk0pN, where 'N' is
the partition number that you installed parabola to -
if that was /dev/sdb1 on your host, N will be: 1 -
if that was /dev/sdb2 on your host, N will be: 2

There's no file named /dev/mapper/vg-rootfs as shown in guide

that example is illustration how to use an LVM partition - the
other extlinux.conf example is also a special case, showing how
to use the 64-bit kernel - there is no standard example on that
wiki article - i think one should be added, one that is
compatible with the ARM tarball

what is n8 there?

the entire console= entry is probably not needed - it is also
a special-case example - that is enabling a serial port
connection - you can omit that if a monitor will be plugged into
the lime2 while booting

i believe that the standard extlinux.conf would look like this:

label Parabola GNU/Linux-libre, linux-libre kernel
    kernel /boot/vmlinuz-linux-libre
    initrd /boot/initramfs-linux-libre.img
    fdtdir /boot/dtbs/linux-libre/
    append quiet rw root=/dev/mmcblk0p1

we should add that to the wiki; so the other special-case
examples are not confused to be generally applicable

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

Completed the steps above. Below is the error that throws up.

https://drive.google.com/file/d/1leNAXP8yzZzOVrMWs_v9UJwrd6R_COLV/view?usp=sharing

I tried uploading 4.4MB video with a maximum size limit of 5MB but forum code showed larger than limit.

RE: Olinuxino Lime2 Bootloader - bill-auger - over 3 years ago -

this errors are saying that there is no partition table - you probably need to partition again, making sure to preserve some free space at the beginning of the disk

using the parted program, you should see some entries like below

$ parted --list
....
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      2097kB  2099MB  2097MB  primary  ext4
 2      2101MB  26,2GB  24,1GB  primary  ext4
 3      26,2GB  128GB   102GB   primary  ext4

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

I did everything almost right this time. Now I get the following errors

The remote end did not respond in time.missing environment variable: bootfile
Retrieving file: pxelinux.cfg

My partitioning is
10mb blank
512mb swap p1
rest ext4 p2 (parabola)

It seems to me there's some problem with extlinux, here's extlinux

menu title Welcome to U-Boot with Extlinux support!

timeout 50

label Parabola GNU/Linux-libre, linux-libre-lts kernel
        kernel /boot/vmlinuz-linux-libre-lts
        initrd /boot/initramfs-linux-libre-lts.img
        fdtdir /boot/dtbs/linux-libre-lts
        append quiet rw root=/dev/mmcblk0p2

RE: Olinuxino Lime2 Bootloader - infinite_recursion - over 3 years ago -

Solved this. I removed swap completely. If you want to have swap, have it in 2nd partition. Booting partition with FAT32 is not useful, so I removed it completely.

My conf is: 10MB blank at start(taken from olimex debian images), rest ext4.
Another conf can be: 10MB blank at start(taken from olimex debian images), swap at end(2nd partition), rest ext4(in middle, 1st partition).

Keep extlinux as default. Remove kernel entries not present but don't change them for above configuration.

RE: Olinuxino Lime2 Bootloader - bill-auger - over 3 years ago -

so, does this suggest some changes to the wiki documentation?

    (1-14/14)