BeagleBoneBlack Rebuild Debian Image Using image-builder
Contents
Debian Build Instructions
Brief Build Instructions
You'll want a fairly beefy ARM system to run this script. Pickup up any beefy armv7-a system, Dual Core+ / 512Mb+ / sata (or usb-sata), running Ubuntu or Debian.
git clone git://github.com/beagleboard/image-builder.git && cd image-builder
./beagleboard.org_image.sh
Problem with Cross Build
Why you want a ARM system to build the Debian, the reason is cross build have problem currently. qemu is just not reliable enough to run this build script on x86. Building on x86 through qemu 'sometimes' work, lots of random things can happen. ;) The usual failure point for qemu is:
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
Log: (chroot): manual_deborphan
Log: (chroot): add_user
i2c:x:114:
kmem:x:15:
netdev:x:108:
Log: (chroot) adding admin group to /etc/sudoers
debian:x:1000:1000:Demo User:/home/debian:/bin/bash
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Log: (chroot): startup_script
Log: (chroot): debian_startup_script
Log: (chroot) Warning, qemu can fail here... (run on real armv7l hardware for production images)
Log: (chroot): [git clone https://github.com/RobertCNelson/boot-scripts /opt/scripts/ --depth 1]
Cloning into '/opt/scripts'...
POST git-upload-pack (189 bytes)
POST git-upload-pack (198 bytes)
remote: Counting objects: 90, done.
remote: Compressing objects: 100% (74/74), done.
Using BBB to Build
Well if you do not have a fairly beefy ARM system to run this build script. You can use your BeagleBoneBlack to build debian images for the BeagleBoneBlack ;) , Although building speed using BBB board will be very slow (It takes up to several hours depending on you network speed and your SD card speed etc.).
Prepare Build Environment
Prepare BBB Board
First thing is to get the official debian image flashed into eMMC of your BeagleBoneBlack board. And after that boot from the eMMC. Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC
Make Sure System Time is Correct
If BBB system time is incorrect, it may result in building failure, so before start building, make sure system time is correct.
Prepare SD Card
Image building requires storage space, so external storage is needed. USB Storage Device may also work, but haven't been tested yet. Build inside SD card tested working. You may need 64GB SD card to perform full build. 16GB SD card may possible if you modify the build scripts to build one single target only. (The full build will build 'debian-x.x-lxde-armhf', 'debian-x.x-lxde-4gb-armhf' and 'debian-x.x-console-armhf', if you are interested in building image for BBB Rev C only for example, you can build 4gb image alone by modifying the build script).
Prepare SD card as ext4 file system. Make sure there's enough free space.
Normally when SD card inserted, it will be mounted automatically by the debian system under /media. However normally you will not be able to run the build, unmount and remount with exec and dev flags is needed.
debian@beaglebone:/media$ ls
32G BEAGLEBONE
debian@beaglebone:/media$ ls 32G/
backup build_install test Trash
debian@beaglebone:/media$ sudo umount 32G/
debian@beaglebone:/media$ ls
BEAGLEBONE
debian@beaglebone:/media$ sudo mkdir SD32
debian@beaglebone:/media$ ls
BEAGLEBONE SD32
debian@beaglebone:/media$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0boot0 179:8 0 1M 1 disk
mmcblk0boot1 179:16 0 1M 1 disk
mmcblk0 179:0 0 3.7G 0 disk
├─mmcblk0p1 179:1 0 96M 0 part /media/BEAGLEBONE
└─mmcblk0p2 179:2 0 3.6G 0 part /
mmcblk1 179:24 0 29.5G 0 disk
└─mmcblk1p1 179:25 0 29.5G 0 part
debian@beaglebone:/media$ sudo mount -o rw,exec,dev /dev/mmcblk1p1 ./SD32/
debian@beaglebone:/media$ ls SD32/
backup build_install test Trash
debian@beaglebone:/media$
Build
git clone git://github.com/beagleboard/image-builder.git && cd image-builder
./beagleboard.org_image.sh
You may checkout a stable release revision for your build:
Here, the modified build script was created to build 'debian-x.x-lxde-4gb-armhf' target image only:
Build script run finished:
Image Generation
Next is to generate the final images.
Preparation
Make sure there's no missing dependencies, otherwise you may get below warning and errors, and generated images will not be usable.
-----------------------------
Debug: ARM rootfs: armhf-rootfs-debian-wheezy.tar
Debug: image has post-uEnv.txt file
You're missing command partprobe (consider installing package parted)
You're missing command kpartx (consider installing package kpartx)
Your system is missing some dependencies
Debian/Ubuntu: sudo apt-get install dosfstools git-core kpartx wget parted
Fedora: yum install dosfstools dosfstools git-core wget
Gentoo: emerge dosfstools git wget
To install dependencies, as the debug messages indicated:
Debian/Ubuntu: sudo apt-get install dosfstools git-core kpartx wget parted
Fedora: yum install dosfstools dosfstools git-core wget
Gentoo: emerge dosfstools git wget
Generate Images
Navigate to the deploy directory and run the gift_wrap_final_images.sh:
Images Generated
The final images will be generated:
You may find out "bone-debian-7.8-lxde-4gb-armhf-2015-06-24-4gb.img.xz" looks familiar :) Checkout latest BBB Debian images at: http://beagleboard.org/latest-images
Generated Image Testing
Extract the generated image, burn it to SD card, boot and test it:
Misc
BBB CPU Frequency
You may check your BBB CPU frequency before doing the build task. To check the frequency:
cpufreq-info
To set to 1GHZ for example:
sudo cpufreq-set -f 1000MHZ