Skip to content

Commit

Permalink
upgrade to debian stretch
Browse files Browse the repository at this point in the history
* add required packages not installed by default (systemd udev)
* disable predictable network interfaces name through net.ifnames=0
* execute dpkg config on first boot instead of a cross-arch chroot
* add google's dns server for debugging purposes (eg. systemd fails)
  • Loading branch information
bamarni committed Mar 14, 2017
1 parent fef9891 commit 831fbfc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 39 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# pi64

pi64 is an experimental 64-bit OS for the Raspberry Pi 3. It is based on Debian Jessie and backed by a 4.9 Linux kernel.
pi64 is an experimental 64-bit OS for the Raspberry Pi 3. It is based on Debian Stretch and backed by a 4.9 Linux kernel.

## Installation

The latest image is always available in the [releases](https://github.com/bamarni/pi64/releases) section.

Once downloaded, you can follow the [official instructions](https://www.raspberrypi.org/documentation/installation/installing-images/README.md) for writing it to your SD card.

During first boot the installation process will continue for a few minutes, then the Raspberry Pi will reboot and you'll be ready to go.

## Getting started

The default user is `pi` and its password `raspberry`, it has passwordless root privileges escalation through `sudo`.
Expand Down
2 changes: 1 addition & 1 deletion boot/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait init=/root/init_setup.sh
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait net.ifnames=0 init=/root/init_setup.sh
67 changes: 32 additions & 35 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,67 +60,70 @@ root_length=$(echo "$parted_out" | grep -e '^ 2'| xargs echo -n | cut -d" " -f 4
boot_dev=$(losetup --show -f -o ${boot_offset} --sizelimit ${boot_length} pi64.img)
root_dev=$(losetup --show -f -o ${root_offset} --sizelimit ${root_length} pi64.img)

mkdosfs -n boot -F 32 -v $boot_dev
mkdosfs -n boot -F 32 $boot_dev
mkfs.ext4 -O ^huge_file $root_dev



# build rootfs

mkdir -p mnt
mount -v $root_dev mnt -t ext4

mkdir -p mnt/dev
mount -o bind /dev mnt/dev
mount $root_dev mnt -t ext4

multistrap -a arm64 -d $PWD/mnt -f ../multistrap.conf

cp /usr/bin/qemu-aarch64-static mnt/usr/bin/qemu-aarch64-static

cat << EOF | chroot mnt
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
export LC_ALL=C LANGUAGE=C LANG=C
chroot mnt apt-get clean

rm -rf mnt/var/lib/apt/lists/*

cat > /etc/fstab <<EOL
rm mnt/usr/bin/qemu-aarch64-static

cat > mnt/etc/fstab <<EOL
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
EOL

mount -t proc proc /proc
mount -t sysfs sys /sys
echo exit 101 > mnt/usr/sbin/policy-rc.d

echo exit 101 > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
chmod +x mnt/usr/sbin/policy-rc.d

/var/lib/dpkg/info/dash.preinst install
dpkg --configure -a
rm /usr/sbin/policy-rc.d
echo raspberrypi > mnt/etc/hostname

echo raspberrypi > /etc/hostname
echo 127.0.1.1 raspberrypi >> mnt/etc/hosts

echo 127.0.1.1 raspberrypi >> /etc/hosts
echo nameserver 8.8.8.8 > mnt/etc/resolv.conf

cat >> /etc/network/interfaces <<EOL
cat >> mnt/etc/network/interfaces <<EOL
auto eth0
iface eth0 inet dhcp
EOL

useradd -s /bin/bash --create-home -p $(perl -e 'print crypt("raspberry", "password")') pi
echo "pi ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/010_pi-nopasswd
cat > /root/init_setup.sh <<EOL
cat > mnt/root/init_setup.sh <<EOL
#!/bin/sh
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
export LC_ALL=C LANGUAGE=C LANG=C
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
mount -t proc proc /proc
mount -t sysfs sys /sys
mount /boot
mount -o remount,rw /
parted /dev/mmcblk0 u s resizepart 2 \\\$(expr \\\$(cat /sys/block/mmcblk0/size) - 1)
parted /dev/mmcblk0 u s resizepart 2 \$(expr \$(cat /sys/block/mmcblk0/size) - 1)
resize2fs /dev/mmcblk0p2
/var/lib/dpkg/info/dash.preinst install
dpkg --configure -a
rm /usr/sbin/policy-rc.d
useradd -s /bin/bash --create-home -p $(perl -e 'print crypt("raspberry", "password")') pi
echo "pi ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/010_pi-nopasswd
sed -i 's| init=/root/init_setup.sh||' /boot/cmdline.txt
sync
Expand All @@ -129,20 +132,14 @@ rm /root/init_setup.sh
echo b > /proc/sysrq-trigger
EOL

chmod +x /root/init_setup.sh
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF

rm mnt/usr/bin/qemu-aarch64-static
chmod +x mnt/root/init_setup.sh



# install boot stuff

mkdir -p mnt/boot
mount -v $boot_dev mnt/boot -t vfat
mount $boot_dev mnt/boot -t vfat

cp -r ../boot/* mnt/boot

Expand All @@ -156,5 +153,5 @@ cd ..

# compress image

umount mnt/boot mnt/dev mnt/proc mnt/sys mnt
zip pi64.img.zip pi64.img
umount mnt/boot mnt
zip pi64.zip pi64.img
4 changes: 2 additions & 2 deletions multistrap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ debootstrap=Debian
aptsources=Debian

[Debian]
packages=apt kmod dialog netbase net-tools ethtool iproute iputils-ping ifupdown isc-dhcp-client sudo ssh avahi-daemon vim parted ntp
packages=systemd systemd-sysv udev apt kmod dialog netbase net-tools ethtool iproute iputils-ping ifupdown isc-dhcp-client sudo ssh avahi-daemon vim parted ntp
source=http://deb.debian.org/debian/
keyring=debian-archive-keyring
suite=jessie
suite=stretch

0 comments on commit 831fbfc

Please sign in to comment.