-
Notifications
You must be signed in to change notification settings - Fork 434
Adding custom OS version examples
In addition to the readme entry about adding custom OS to noobs I'd like to share the process of doing it.
As an example we try to add Ubuntu Mate as new OS to raspberry pi, since it was not officially added by the foundation yet.
This tutorial was tested and works with Noobs 1.5. Also see this thread as reference.
You need to use a Linux PC to create the image of course. Basic Linux knowledge is required.
# Most of the time you need to use the root user. Be careful!
# Also note the size in MB (round up) for the partition_size_nominal value.
# Commands inside parted: print quit
parted ubuntu-mate-15.10.1-desktop-armhf-raspberry-pi-2.img
# Create loopback devices for mounting
# Then mount the partitions via GUI or command line
sudo kpartx -av ubuntu-mate-15.10.1-desktop-armhf-raspberry-pi-2.img
# Get the size of the extracted tar archive we created below.
# Note the values for the uncompressed_tarball_size.
cd /media/username/
sudo du PI_BOOT -sh --block-size=1MB
sudo du PI_ROOT -sh --block-size=1MB
# Pack the files. root/ has to be packed with root user. This takes quite some time.
cd /media/username/PI_BOOT
tar -cpf /tmp/boot.tar .
xz -9 -e /tmp/boot.tar
cd /media/username/PI_ROOT
sudo tar -cpf /tmp/root.tar . --exclude=proc/* --exclude=sys/* --exclude=dev/pts/*
xz -9 -e /tmp/root.tar
# Unmount the partitions via gui or command line. Then do:
sudo kpartx -dv ubuntu-mate-15.10.1-desktop-armhf-raspberry-pi-2.img
Now create a folder inside os
named Ubuntu
. Place the two created tar.xz files in there.
You also need to create a few other files:
#!/bin/sh
set -ex
if [ -z "$part1" ] || [ -z "$part2" ]; then
printf "Error: missing environment variable part1 or part2\n" 1>&2
exit 1
fi
mkdir -p /tmp/1 /tmp/2
mount "$part1" /tmp/1
mount "$part2" /tmp/2
sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|"
sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |"
sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |"
umount /tmp/1
umount /tmp/2
{
"partitions": [
{
"label": "boot",
"filesystem_type": "FAT",
"partition_size_nominal": 63,
"want_maximised": false,
"uncompressed_tarball_size": 21
},
{
"label": "root",
"filesystem_type": "ext4",
"partition_size_nominal": 3867,
"want_maximised": true,
"mkfs_options": "-O ^huge_file",
"uncompressed_tarball_size": 3407
}
]
}
{
"name": "Ubuntu_Mate",
"version": "wily",
"release_date": "2015-12-21",
"kernel": "4.1",
"description": "Ubuntu MATE for the Raspberry Pi 2",
"url": "https://ubuntu-mate.org/raspberry-pi/",
"supported_hex_revisions": "1040,1041",
"feature_level": 0
}
The Icon for Ubuntu is also missing, but not important. You can download it yourself, resize it to 40x40px and name it the same as the Ubuntu_Mate folder aka Ubuntu_Mate.png
.
I took the image from bitbucket and resized it to 40x40px.
$ ls /os/Ubuntu_Mate -l
-rw-rw-r-- 1 username username 11040008 Feb 6 23:54 boot.tar.xz
-rw-rw-r-- 1 username username 272 Feb 7 10:44 os.json
-rwxr--r-- 1 username username 420 Nov 21 22:43 partition_setup.sh
-rwxr-xr-x 1 username username 414 Feb 7 00:12 partitions.json
-rw-rw-r-- 1 username username 913935756 Feb 6 23:58 root.tar.xz
-rw-rw-r-- 1 username username 2720 Feb 7 09:59 Ubuntu_Mate.png
Note: To edit the files on Ubuntu you need to delete the risc os partition table:
sudo dd if=/dev/zero of=/dev/sdx bs=512 conv=fsync seek=1 count=19
To mount the first partition via GUI you need to rename it from RECOVERY
to something else. Otherwise its hidden.
- https://downloads.raspberrypi.org/osmc_pi1/os.json (only compatible with Pi1)
- https://downloads.raspberrypi.org/osmc_pi2/os.json (only compatible with Pi2)
- https://downloads.raspberrypi.org/raspbian/os.json (compatible with all Pis)