Other Advanced Balsa Configurations

From LSDevLinux
Jump to: navigation, search

Introduction

This page tells you about advanced, non-standard Balsa Prototype configurations. It is meant for someone in a technical support role. It supplements the overview pages for Windows and Linux. (Read one or the other of them first).

Running Balsa on a device other than an SD card

As part of the boot process, Balsa transfers control to the Balsa device using the vmlinuz and initrd.img files. (On a Windows host C:\BalsaBoot\vmlinuz and C:\BalsaBoot\initrd.img; on a Linux host, /boot/balsa/vmlinuz and /boot/balsa/initrd.img). This process finds the SD card partition BalsaRoot by its partition label. If you have created a partition elsewhere labelled BalsaRoot, it will use that partition for the Balsa system. You can use this feature to run Balsa on a device other than an SD card.

The Balsa install script on a Linux host assumes that there is only one partition named BalsaRoot when it runs. If you have a USB stick or a BalsaRoot partition, don't run that script with a BalsaRoot SD card as well.

Using a USB Stick

There's nothing special about an SD card that makes it the only device you can run Balsa from. You can use a USB memory stick instead. With an 8 gig USB memory stick, you should be able to use the same initialize process as for an SD card, i.e., Win32Imager (Windows) or dd/usb-imagewriter (Linux). Some memory sticks may be pre-formatted in special ways that can make this difficult under Windows.

Using a Partition on the Host Machine

The warning below applies to this configuration.

Use your favourite partition manager program to create a partition for the BalsaRoot big enough to hold Balsa image, currently 8 gigabytes. Copy the BalsaRoot partition from either the Balsa image you downloaded and extracted or from a Balsa SD card.

Partition on a Windows machine

Your partition manager may allow you to copy the image to the partition. If not, you may be able to use Win32Imager to do this. This has not been tested, and may overwrite the wrong disk.

Follow the instructions on the page of how to Produce a Balsa SD card. If you already have an extracted Balsa image, you don't have to download and extract one. When it comes to writing the card use the partition you made above rather than the SD card. Those instructions are here: Download and Produce a Balsa SD Card using a Windows Machine

Partition on a Linux machine

You can also use a Linux LiveCD to do this. You should know how to use the Linux terminal command line, and how to mount partitions.

Follow the instructions on the page of how to Produce a a Balsa SD card. If you already have an extracted Balsa image, you don't have to download and extract one. When it comes to writing the card use the partition you made above rather than the SD card.

Those instructions are here: Download and Produce a Balsa 8 gigabyte SD Card using a Linux Machine

Balsa on a Virtual Machine

The warning below applies to this configuration.

For a Balsa system on a virtual machine (VM) you need two or three partitions:

  • A boot partition containing the host system with the Balsa boot files.
  • A partition containing Balsa data file(s).
  • A Linux ext3 partition containing the contents of the Balsa SD card BalsaRoot partition.

The first and second partitions can be the same partition, or you can configure a boot partition separate from the data partition. If the data partition is a Windows NTFS/VFAT partition, Balsa, by default will use 10% of the free space on the partition up to a maximum of 1 gigabyte. There are instructions below on how to change its size. You will also need 512 Mbytes for a swapfile.

The BalsaRoot partition can be a partition on an external device (an SD card or USB stick) or can be a partition that contains the data copied from an SD card or image. Copying the data can be by copying the image onto the partition, or copying file by file keeping the Linux permissions.

Balsa with a Windows VM

I have not been able to get this to work with VirtualBox with an Windows XP VM. It apparently doesn't allow you to boot to a Linux kernel from the Windows boot loader. I suspect the particular Windows XP installation I used, so YMMV. If you want to try this configuration, you should be able to just follow the Quick Start for Balsa on a Windows VM that has USB or shared folders support.

Note from JimH44, 2012-09-25

I have been able to get Balsa running on a Linux system running in VirtualBox on a Windows XP host. If you normally use Windows and want to demonstrate Balsa, this installation has the advantage that you don't need to reboot the Windows machine to do the demonstration -- the Balsa system runs in a window on the Windows system.

You can download my documentation of how to do this (dated 2011-11-03) from http://linux.lsdev.sil.org/misc/Setting_up_Balsa_over_VirtualBox_on_Windows.pdf

Please email me if the procedure doesn't work for you, and we can work together on a solution.

Jim

Balsa on a Linux VM host

Balsa works well running with VirtualBox with a Ubuntu VM. You can set up the VM using a Ubuntu ISO image, then modify the VM to boot to Balsa, like a regular Linux machine. See the instructions at Set Up a Linux Machine for Balsa. The next time you boot the machine it will have a Balsa option in the grub boot menu.

You can use a virtual drive to hold the BalsaRoot. Read the section above #Partition on a Linux machine to read how to do that. You will have to have the VirtualBox Guest additions to do that in VirtualBox.

Balsa on a Minimal VM host

Balsa doesn't have to have a functioning operating system on the boot drive, just an entry in the MBR, a grub loader and a config file that points to the Balsa vmlinuz and initrd files.

The bootlace.com program from the GRUB4DOS release writes the MBR.

This VM configuration makes a small virtual drive They are contained on the Balsa SD card in the BALSASHARED partition:

  • \grldr, \grldr.mbr — GRUB4DOS boot files.
  • \menu.lst — contains GRUB4DOS control file
  • \BalsaBoot\vmlinuz & \BalsaBoot\initrd.img — Balsa host kernel files


  • This can be the Balsa SD card on a USB device if speed is not an issue, and there's USB support on the VM.
  • The Balsa boot cycle locates and mounts this as the root partition by label.


A Warning

Note that if you set up Balsa on something other than an SD card / USB stick, you lose the simplicity of updating Balsa by simply changing the SD card / USB stick.

Modifying The Location of the Balsa Data

Note that if you modify the location of the Balsa data, the Balsa swap file (.5 Gbytes) will be moved to the same location.

The Location of the Balsa Data on a Windows Host

With Windows, by default, Balsa will place the Balsa data on C:\. However, if you run SetUpBalsa.cmd from a command line, you can put the drive letter of the drive you want to put it on as the command line parameter. For Example, SetUpBalsa.cmd F.

There is a unique number for partition called a UUID SetUpBalsa.cmd reads the UUID for the drive and uses that to identify the location of the Balsa files. This information is stored in the boot configuration file C:\menu.lst. It will have a line that looks like this:

kernel /BalsaBoot/vmlinuz root=LABEL=BalsaRoot BALSAFILES=UUID=72F46D86F46D4E03 panic=20 ro quiet splash  

In this case the ID for the partition with the Balsa data is 72F46D... You can edit C:\menu.lst to change it to find the data elsewhere. You don't have to use the drive ID number to locate the Balsa data. You can use the partition label by changing the BALSAFILES=UUID= to BALSAFILES=LABEL=. For example if you wanted to store the data on a partition with the drive label Work you would change that line to BALSAFILES=LABEL=Work

The Location of the Balsa Data on a Linux Host

On a Linux host system, the Balsa setup script /usr/share/balsa/grub_balsa-install.sh looks for the device where /home is mounted, and uses that for the location of the Balsa data files. It stores this information in the file /etc/grub.d/06_balsa and uses that file to build a grub menu. Here's an example line from a 06_balsa file:

linux    /boot/balsa/vmlinuz root=LABEL=BalsaRoot panic=20  BALSAFILES=/dev/sda5 ro quiet splash

In this case the device designation for the partition with the Balsa data is /dev/sda5. You can edit 06_balsa to change it to find the data elsewhere. You don't have to use the drive ID number to locate the Balsa data. You can use the partition label by changing the BALSAFILES= to BALSAFILES=LABEL=. For example if you wanted to store the data on a partition with the drive label Work you would change that line to BALSAFILES=LABEL=Work

To put your changes into effect, run:

sudo update-grub

Change the Size of the balsafiles.img File

to be written - here's an outline

  1. change the /etc/default/balsa using sudo from the Advisor account to the new size. These parameters only affect the creation of a new balsafiles.img.
  2. reboot to the host system - normally Windows. (Linux doesn't normally use balsafiles.img)
  3. rename balsafiles.img to balsafiles-old.img
  4. reboot to Balsa, in the Advisor account. This will create a new balsafiles.img with the new size, with a newly initialized Balsa system.
  5. Next we copy the Balsa data from the old balsafiles to the current one:
 Loop mount /run/balsahost/balsafiles-old.img on /mnt
 sudo rsync --delete -axHAX --progress /mnt/home /home
 sudo cp /mnt/etc/passwd /etc/passwd
 sudo cp /mnt/usr/share/balsa/version /usr/share/balsa/version
  1. Reboot to the host system
  2. Delete balsafiles-old.img

Running Multiple Balsa Datasets on a Single Host

to be written - here's an outline

If it's a Windows machine, set up a separate balsafiles.img for each dataset. E.g. balsafiles-language1.img, balsafiles-language2.img, balsafiles-language3.img. Before you boot into balsa, copy the correct dataset into balsafiles.img. After you finish running Balsa with that dataset, reboot to the host and copy balsafiles.img back to the corresponding balsafiles-language<n>.img.

If it's a Linux host do the same with /balsafiles and /balsafiles-language<n> using rsync to swap the data in and out of the current dataset.

Another option would be to set up different virtual machines for each instance. This would have the advantage of not having to reboot and swap to change datasets.

Changing the Size of the Swap File

When Balsa starts, it creates a swap file on the host machine. By default, the swap file is 512 Mbytes. If you need to change the size of this swap file, do the following:

  1. Log into the Advisor account in Balsa.
  2. Run Terminal.
  3. Enter the commands below, changing the count=512 on the second line to the value you want:
swapoff /run/balsahost/balsaswap.img
dd if=/dev/zero of=/run/balsahost/balsaswap.img bs=1M count=512
mkswap /run/balsahost/balsaswap.img
swapon /run/balsahost/balsaswap.img