Skip to content

Commit

Permalink
Merge pull request #11 from bitinerant/master
Browse files Browse the repository at this point in the history
add support for Ubuntu for ARM
  • Loading branch information
chesty authored Oct 25, 2019
2 parents ca1c9e5 + d79d24b commit 7bad57c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ I use this for my Raspberry Pi, but it should work on any Debian or derivative.
The root file system on the sd-card is mounted read-only on /overlay/lower, and / is a
read-write copy on write overlay.

There are two sets of instructions below: [Raspbian](#raspbian) and [Ubuntu for ARM](#ubuntu-for-arm).

## Raspbian

It uses initramfs. Stock Raspbian doesn't use one so step one would be to get initramfs working.
Something like:

Expand Down Expand Up @@ -39,6 +43,33 @@ then rerun
```bash
sudo mkinitramfs -o /boot/init.gz
```
Now skip down to [all distributions](#all-distributions) to finish the installation.

## Ubuntu for ARM

Add the following line to /etc/initramfs-tools/modules
```
overlay
```

Copy the following files
- hooks-overlay to /etc/initramfs-tools/hooks/
- init-bottom-overlay to /etc/initramfs-tools/scripts/init-bottom/

install busybox-static
```bash
sudo apt-get install busybox-static
```

then run

```bash
sudo update-initramfs -k $(uname -r) -u
```

Now continue to [all distributions](#all-distributions) to finish the installation.

## all distributions

add to .bashrc

Expand Down Expand Up @@ -72,12 +103,18 @@ It's probably a good idea to reboot now for 2 reasons:
- leaving /overlay/lower read-write could cause file corruption on power loss.
- to test it still boots ok after the changes you've just made.

Whenever the kernel is updated you need to rerun
Whenever the kernel is updated, for Raspbian you need to rerun

```bash
sudo mkinitramfs -o /boot/init.gz
```

and for Ubuntu for ARM

```bash
sudo update-initramfs -k $(uname -r) -u
```

TODO: see if there's a hook to automatically run `sudo mkinitramfs -o /boot/init.gz`
on kernel install

Expand Down
20 changes: 12 additions & 8 deletions rootwork
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ test_mountpoints () {
}

mount -o remount,rw "$ROOT" || { echo "error remounting $ROOT rw"; exit 1; }
if is_mounted /boot; then
mount -o remount,rw /boot || { echo "error remounting /boot rw"; exit 1; }
fi
for DIR in boot boot/firmware; do
if is_mounted "/$DIR"; then
mount -o remount,rw "/$DIR" || { echo "error remounting \"/$DIR\" rw"; exit 1; }
fi
done

for DIR in boot run; do
for DIR in boot boot/firmware run; do
if test_mountpoints "/$DIR" "$ROOT/$DIR"; then
mount --rbind "/$DIR" "$ROOT/$DIR"
fi
Expand Down Expand Up @@ -90,15 +92,17 @@ fi

# with mount --rbind /run $ROOT/run, umounting $ROOT/run is problematic as it's busy and if you umount -lf it umounts directories in /run/.
# I think because / is an overlay of $ROOT. So we don't unmount $ROOT/run
for DIR in boot; do
for DIR in boot/firmware boot; do
if is_mounted "$ROOT/$DIR"; then
umount -lf "$ROOT/$DIR"
fi
done

if is_mounted /boot; then
mount -o remount,ro /boot
fi
for DIR in boot/firmware boot; do
if is_mounted "/$DIR"; then
mount -o remount,ro "/$DIR"
fi
done

mount -o remount,ro "$ROOT" || {
echo "Failed to remount $ROOT read-only, possibly because of an open file."
Expand Down

0 comments on commit 7bad57c

Please sign in to comment.