This is an old revision of the document!


HowTo create your own (RaspberryPi) image file

It is written based upon how it works for the RPiv1, basically all archlinux images should follow the same concepts. You only need the correct Archlinux.tar file and qemu kernel file. The scripts that help during the creation can be found on the Github: arch_rpi_image_prepare.

Software Requirements

  • qemu with support for armv6 (for raspberry emulation)
    • under archlinux, install extra/qemu-arch-extra
  • workin “sudo” environment
  • losetup from util-linux 2.2 (at least)
  • mkfs.vat
  • mkfs.ext4
  • wget
  • fdisk
  • git

Create the basic Image file

Choose a working directory

 mkdir -p ~/tmp
 cd ~/tmp
 git clone https://github.com/PirateBox-Dev/arch_rpi_image_prepare.git
 cd  arch_rpi_image_prepare/
  

Get latest service & motd file

  cd staging_packages 
  wget https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/master/BuildScripts/piratebox.service    
  wget https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/master/BuildScripts/timesave.service
  wget https://raw.githubusercontent.com/PirateBox-Dev/PirateBoxScripts_Webserver/master/BuildScripts/RPi_motd.txt

Prepare Bootstrap image, which runs the emulation. That image will be created based upon the latest archlinux-armv6 file

   cd -
   make create_arch_image

Create an installation qemu image

Create a woring qemu image once (only needed on first setup).

  # HINT: This should be included into the makefile..
  cd qemu-arm-rpi
  cp ../raw_arch_image_file  install_qemu_image
  # now fix qemu specific stuff
  sudo losetup -f -P install_qemu_image 
  mkdir tmp
  sudo mount /dev/loop0p2 tmp
  sudo sed -i 's|^/dev/mmcblk0p1|#/dev/mmcblk0p1|' tmp/etc/fstab
  sudo umount tmp
  sudo losetup -D
  
  

Now you need X. Startup the qemu instance. it will mount the raw_arch_image_file as a 2nd device.

  ./run_qemu.sh

HINT: The emulation may have a different keyboard setting.

Prepare the imagefile for distribution

(Re)Start the emulation:

  ./run_qemu.sh

After bootup, login using username: root ; password: root

HINT: To leave the emulation with the mouse, press CTRL+ALT

Start prepare the image..

  sh /prebuild/staging/install_packages.sh

When this scripts ends conditionally, then the image is prepared :)

Tidy up and exit the qemu-vm

  umount -R /mnt/image
  reboot

Then pack the file

  zip -9 <zip filename> raw_arch_image_file

Troubleshooting

If you encounter the following error

  /dev/loop0p1: No such file or directory
  Makefile:65: recipe for target 'format_p1' failed

Then do

  make free_lo

Then try again… sometimes the kernel isn't fast enough on the first try…