diff --git a/README.md b/README.md index 4e646ac0..97dfab90 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ ## Intro -The minimal Raspbian unattended netinstaller for Raspberry Pi Model 1B, 1B+ and 2B. +The minimal Raspbian unattended netinstaller for Raspberry Pi Model 1B, 1B+, 2B and 3B. This project provides [Raspbian][1] power users the possibility to install a minimal base system unattended using latest Raspbian packages regardless when the installer was built. diff --git a/build.sh b/build.sh index 078b5a5e..70dbb4ec 100755 --- a/build.sh +++ b/build.sh @@ -545,7 +545,7 @@ cp installer-rpi1.cpio.gz bootfs/ echo "[pi1]" >> bootfs/config.txt echo "kernel=kernel-rpi1_install.img" >> bootfs/config.txt echo "initramfs installer-rpi1.cpio.gz" >> bootfs/config.txt -echo "device_tree=" >> bootfs/config.txt +#echo "device_tree=" >> bootfs/config.txt create_cpio "rpi2" cp installer-rpi2.cpio.gz bootfs/ @@ -553,6 +553,15 @@ echo "[pi2]" >> bootfs/config.txt echo "kernel=kernel-rpi2_install.img" >> bootfs/config.txt echo "initramfs installer-rpi2.cpio.gz" >> bootfs/config.txt +# rpi3 uses the same kernel/initramfs as rpi2, so just copy the block +echo "[pi3]" >> bootfs/config.txt +echo "kernel=kernel-rpi2_install.img" >> bootfs/config.txt +echo "initramfs installer-rpi2.cpio.gz" >> bootfs/config.txt +# on the rpi3 the uart port is used by bluetooth by default +# but during the installation we want the serial console +# the next statement does that, but consequently also disables bluetooth +echo "enable_uart=1" >> bootfs/config.txt + # clean up rm -rf tmp diff --git a/scripts/etc/init.d/rcS b/scripts/etc/init.d/rcS index 28074906..1e410165 100755 --- a/scripts/etc/init.d/rcS +++ b/scripts/etc/init.d/rcS @@ -173,11 +173,28 @@ tee < ${LOGFILE}.pipe $LOGFILE & exec &> ${LOGFILE}.pipe rm ${LOGFILE}.pipe -rpi_hardware=$(grep Hardware /proc/cpuinfo | cut -d " " -f 2) -case $rpi_hardware in - BCM2708) rpi_hardware_version="1" ;; - BCM2709) rpi_hardware_version="2" ;; - *) rpi_hardware_version="unknown" ;; +# we should do this with bitshift operations, I think on the serial +# http://elinux.org/RPi_HardwareHistory#Board_Revision_History +cpu_revision=$(grep Revision /proc/cpuinfo | cut -d " " -f 2 | sed 's/^1000//') +case $cpu_revision in + 0011|0014) + rpi_hardware_version="cm" + ;; + 900092|900093) + rpi_hardware_version="0" + ;; + 0002|0003|0004|0005|0006|0007|0008|0009|000d|000e|000f|0010|0012|0013|0015|900032) + rpi_hardware_version="1" + ;; + a01041|a21041) + rpi_hardware_version="2" + ;; + a02082|a22082) + rpi_hardware_version="3" + ;; + *) + rpi_hardware_version="unknown" + ;; esac echo "" @@ -373,15 +390,16 @@ if [ "$hardware_versions" = "detect" ]; then case $rpi_hardware_version in 1) hardware_versions="1" ;; 2) hardware_versions="2" ;; + 3) hardware_versions="3" ;; *) echo "" echo "=================================================" echo " No Raspberry Pi hardware detected!!" - echo " Value of rpi_hardware variable: '${rpi_hardware}'" - echo " Building for both Pi and Pi 2. " + echo " Value of cpu_revision variable: '${cpu_revision}'" + echo " Building for Pi 1, 2 and 3. " echo "=================================================" echo "" - hardware_versions="1 2" + hardware_versions="1 2 3" ;; esac fi @@ -447,7 +465,7 @@ if [ "$cdebootstrap_cmdline" = "" ]; then do case $hv in 1) kernel_meta_package=linux-image-rpi-rpfv ;; - 2) kernel_meta_package=linux-image-rpi2-rpfv ;; + 2|3) kernel_meta_package=linux-image-rpi2-rpfv ;; *) echo "" echo "=================================================" @@ -1076,14 +1094,21 @@ do echo "kernel=vmlinuz-$KERNEL_VERSION" echo "initramfs initrd.img-${KERNEL_VERSION} followkernel" if [ "${hv}" = "1" ] ; then - echo "# to enable DeviceTree, comment out the next line " - echo "device_tree=" + echo "# to disable DeviceTree, uncomment the next line " + echo "#device_tree=" + fi + if [ "${hv}" = "3" ] ; then + # we should probably add a config parameter for uart purpose + # as the statements below disables bluetooth which various/most + # people will prefer over the serial console + echo "# enable the serial console for the installed system" + echo "#device_tree=" fi } >> /rootfs/boot/config.txt # set the default kernel file based on the hardware case ${hv} in - 2) default_kernel_file="kernel7.img" ;; + 2|3) default_kernel_file="kernel7.img" ;; *) default_kernel_file="kernel.img" ;; esac