Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpi3 support #418

Merged
merged 6 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,23 @@ 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/
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

Expand Down
49 changes: 37 additions & 12 deletions scripts/etc/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

@Mausy5043 Mausy5043 Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add |900032 ? (#415)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. See new commit.

rpi_hardware_version="1"
;;
a01041|a21041)
rpi_hardware_version="2"
;;
a02082|a22082)
rpi_hardware_version="3"
;;
*)
rpi_hardware_version="unknown"
;;
esac

echo ""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "================================================="
Expand Down Expand Up @@ -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="
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "enable_uart=1" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Thanks for spotting this 👍

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

Expand Down