[Solved] Problems installing Voidlinux on Bananapi


(Rubén Santos) #1

Hi,

Im trying to install voidlinux on my Bananapi M1.

My first attemp was flashing the last mainline version of Armbian into the sdcard and then replace everything except /boot with the cubieboard rootfs available in the repos. This method failed with many timeouts from tftp trying to locate some boot files.

Then I found that in the void-mklive script “mkplatformfs.sh” is available a bananapi profile, so I created the rootfs with mkplatformfs and then created the image with mkimage.
I flashed it into the sdcard, but the board just start shining with a green light, and nothing appears in the screen.

Some info:

Partitions:

Device     Boot  Start      End  Sectors  Size Id tipo
/dev/sdb1  *      2048   133119   131072   64M  b W95 FAT32
/dev/sdb2       133120 13671874 13538755  6,5G 83 Linux

/boot content:

 -rwxr-xr-x 1 root root  50K Xan 19  2015 script.bin
 -rwxr-xr-x 1 root root 264K Xan 19  2015 u-boot-sunxi-with-spl.bin
 -rwxr-xr-x 1 root root  378 Xan 19  2015 uEnv.txt
 -rwxr-xr-x 1 root root 3,3M Dec 11  2016 zImage

/ content:

drwxr-x---  2 root root 4,0K Xan  7 23:09 boot
drwxr-x---  2 root root 4,0K Xan  7 22:43 dev
drwxr-xr-x 23 root root 4,0K Xan  7 22:43 etc
drwx------  2 root root  16K Xan  7 23:09 lost+found
drwxr-x---  2 root root 4,0K Xan  7 22:43 proc
drwxr-x---  2 root root 4,0K Xan  7 22:43 sys
drwxr-xr-x  7 root root 4,0K Xan  7 22:43 usr
drwxr-x---  3 root root 4,0K Xan  7 22:43 var

Do any of you have Voidlinux working in bananapi using the mklive method?

Do you know of any other methods that work?

Thank you!


Does Void Linux support Banana Pi BPi-R2?
#2

I do not have a Banana Pi. I have Void linux working on a Raspberry Pi 3b and a ZeroW. They work fine with the Void builds. I tried to install the Void Odroid build onto my Orange Pi and never did get that to work.

I don’t know how to make the Banana Pi work except have some questions after looking at your file list. I imagine you made the file and directory list while the sdcard was plugged into your main computer. Is the /boot directory the same as would be the /dev/sda1 mounted into the /boot when the Banana Pi would be running? That should be in your /etc/fstab on the sdcard. If not the same as /boot then could you show the contents of the /dev/sda1 or sdb1 if mounted on your main computer? There should be some dtb files someplace.
Perhaps you could look at the instructions for the Raspberry Pi to see how to mount and flash the files because that might be similar just not exactly the same. The /boot should be empty to begin until the vfat partition is mounted to the second partition /boot in the sdcard. That is the way the Armbian works with the Orange Pi and the way Void works on the Raspberry Pi. I am looking for the files about the DeviceTree. I imagine they are similar to the dtb files in the Armbian and the very slow and bloated Raspbian.

Sorry for the guessing because I don’t have Void working on a Banana Pi not even my Orange Pi. Good luck.


#3

I easily installed Void on all my ARM machines, Orange PI 2, Banana Pi M2+ and Banana Pi M3.
The easiest way is, first, to install a system (Armbian or any other one) which runs fine for the board in a SD card.
Then, you may, either replace all the file system by Void, or cut the SD card to let a free partition for Void.
The copy of the Void file system must be done logically (by ‘copy’ or ‘tar’, not by ‘dd’).
In the first solution, you have to keep the boot file (in /boot with uImage) and the modules (in /lib/modules/…) of the base system before erasing the file system, and then to copy them back in Void at a same place. The system should boot directly.
In the second solution, you must copy only the modules of the base system to Void. Then, you should have 2 runable systems in the SD card, and you choose which one to boot changing the ‘root=’ kernel parameter in boot.scr. That is what I did in the BPiM2+ I am using now:

$ lsblk
mmcblk0      179:0    0   7.4G  0 disk 
├─mmcblk0p1  179:1    0     4G  0 part /mnt
└─mmcblk0p2  179:2    0   3.4G  0 part /

In /dev/mmcblkp01 (Armbian base)

$ ls /mnt
bin/  boot/  dev/        etc/            home/           lib/   lost+found/  media/
mnt/  opt/   proc/       root/           run/            sbin/  selinux/     srv/
sys/  tmp/   uImagebm2p  uImagebm2p-4.8  uImagebm2p-4.9  usr/   var/
$ ls -l /mnt/boot                                                               
drwxr-xr-x 2 root root    4096 Jul 12  2016 bin/
-rw-r--r-- 1 root root    6944 Jun  1  2016 boot.bmp
-rw-r--r-- 1 root root    2275 Jun  1  2016 boot.cmd
-rw-r--r-- 1 root root    1670 Jul  7  2016 boot.scr
-rw-r--r-- 1 root root   95050 May 31  2016 config-3.4.112-sun8i
-rw-r--r-- 1 root root       0 Jul  7  2016 .next
lrwxrwxrwx 1 root root      22 Jun  1  2016 script.bin -> bin/bananapim2plus.bin
-rw-r--r-- 1 root root 2128821 May 31  2016 System.map-3.4.112-sun8i
lrwxrwxrwx 1 root root      13 Jul 21  2016 uImagebm2p -> ../uImagebm2p
-rw-r--r-- 1 root root 3112468 Jun  1  2016 uInitrd
-rwxr-xr-x 1 root root 5064616 May 31  2016 vmlinuz-3.4.112-sun8i*
lrwxrwxrwx 1 root root      21 Jun  1  2016 zImage -> vmlinuz-3.4.112-sun8i*

In /boot/boot.scr of /dev/mmcblkp01, I set (I have a specific vanilla Linux kernel 4.9.67 with the DTB included):

setenv bootargs "console=ttyS0 root=/dev/mmcblk0p2 rootwait rootfstype=ext4 panic=10 loglevel=7"
...
# sunxi mainline kernel
#----------------------
#jfm 16-07-07
ext4load mmc 0 40007800 /boot/uImagebm2p
bootm 40007800

In the Void file system, /boot is empty


#4

I am encouraged to try again with my Orange Pi Lite. My concern when trying to use the Void Odroid build with the Orange Pi was the bootloader. I doubt the Odroid bootloader would be compatible with the Orange Pi except I don’t know for sure.

Did you remove the bootloader packages from the Void builds for the Cubiboard or Odroid when using those for the Banana Pi and the Orange Pi?


#5

For the ARM boards, the most important pieces of software are the u-boot (you called it bootloader) and the kernel (with its modules). They are specific to your board, so, it is better to keep these pieces from a distro working in the board (base system).

The u-boot is before the first partition in the SD card. It may be saved and restored by ‘dd’. An examination of the partition table will give you its size.

The u-boot uses information in the files of the first partition, usually in the directory ‘/boot’. One of these files, ‘boot.scr’ contains the commands for booting the Linux kernel. You may know its content by ‘strings’. It is created by mkimage from a text file:

mkimage -C none -A arm -T script -d boot.txt boot.scr

To build your SD card, you have 2 options:

  • if the size of the u-boot of your base system is smaller than the u-boot of the Void system you chose, you can
    • create a SD card as indicated in the Void wiki, but without the u-boot stuff
    • copy the u-boot of your base system to the SD card (by ‘dd’)
  • otherwise
    • create a SD card with your base system (running distro)
    • destroy the SD card partition, and re-create it as indicated in the wiki or as you want (modern u-boots know about ext2,3 and 4, so you may have the same partition for the boot and the system)
    • untar the Void rootfs

At the end,

  • copy the ‘/boot’ to the right partition, and the kernel and modules of your base system to Void
  • possibly update ‘/boot/boot.scr’

#6

Thank you for the detailed answer. I shouldn’t worry if the u-boot is just on the sdcard.

Yes I was referring to the u-boot as the bootloader. I imagined the u-boot would update the internal files the cpu uses to read the sdcard looking for the kernel. That was my mistake.

I also have a tv box with an arm soc and there are cautions for that when installing linux over the dreded android built into the box. The raspberry pi and orange pi don’t have the internal flash memory as in the tv box or an android phone so I can see now how the u-boot would be located before the first partition similar to a bootable dos disk.

The explanation for the mkimage is very informative so thanks again.


(Rubén Santos) #7

Thank you all for your replies.

I will try to install it again following your tips. :+1:


(Rubén Santos) #8

Hi

Finally I was able to install Voidlinux in the Bananapi. The only thing that I missed from my first try was keeping the /lib/modules/* from the Armbian base. :sweat_smile:

BTW I tried again to create a void image using the void-mklive tools, without the Armbian files. This time I followed this guide to create the rootfs:

git clone git://github.com/voidlinux/void-mklive.git
cd void-mklive
make
sudo ./mkrootfs.sh armv7l
sudo ./mkplatformfs.sh -b "uboot-mkimage dracut" bananapi void-armv7l-ROOTFS-*.tar.xz
sudo ./mkimage.sh void-bananapi-PLATFORMFS-*.tar.xz

As you can see, I set an option to install uboot-mkimage and dracut. That’s because looking at the mkplatformsfs.sh code, I found that if theres is not /boot/uInitrd, the script can generate it if these packages are installed.

After flash this img to the sdcard, it still didn’t boot.
I also copied the boot.txt from the cubieboard tarball and create the boot.scr, but doesn’t boot either.

So what’s missing in this process to get all the needed /boot files?

The bananapi profile in mkplatformfs.sh generates the rootfs using these packages: bananapi-base and bananapi-uboot

So, am I missing a step, or is something missing in the bananapi void packages?

It would be nice if you can try to build the tarball using the void-mklive scripts to find out what im missing, so we can have a voidlinux rootfs without need of Armbian anymore. :wink:

Thank you!


#9

The most important for ARM boards are the u-boot and the kernel (with its modules).
Each u-boot is specific of the board, so, you need a distro running on the board for getting the u-boot.
But, this distro also offers the kernel and the modules, so, why not using it?
On the other side, the Linux distributions are a file system and the couple (u-boot + kernel). When you already have the u-boot+kernel, you only have to copy the file system to the SD card and then add the kernel modules of the base kernel.
There is no need to re-generate a root file system: it would be the same as the one you got from the distribution you want to install (Void, but also Alpine, Arch…).
I have 3 ARM boards. The Orange Pi 2 and the Banana Pi M2+ have a Allwinner H3 SoC. They have a same kernel, but their DTs are different, and so are the u-boot’s. The Banana Pi M3 has a Allwinner A83T SoC, and, so, a different kernel / u-boot. In the SD cards of these 3 machines, I put the same VoidLinux file system (odroid, but this does not matter) changing only the kernel modules (these are the same for all 3 boards).


#10

It actually woud be nice to have some guide / wiki, where installation instructions will be available.

I’m still didn’t decide what to install on my orange-pi-zero: LEDE (for which there is ready distribution) or VoidLinux (I like it more, as I use it for desktop).


#11

If you followed what I wrote, you may have many distros on a same SD card (most distros like Void are smaller than 4 Gb). You just have to change the kernel root path in the file /boot/boot.scr of the first partition (or in the bootargs of the u-boot if you use a 2nd computer and the UART).

An other idea is to put the root file systems on external drives (USB hard disk or memory stick). I did that with my Dove Cubox: one distro per USB stick and a default one in the SD card.

About some guide/wiki, I think that the owners of development boards have to read a lot of documentation before being able to change the base system of their machines: there are many different boards and many ways for each one to do it…