@@ -74,6 +74,9 Use debootstrap script variant `minbase` which only includes essential packages | |||||
74 | ##### `ENABLE_UBOOT`=false |
|
74 | ##### `ENABLE_UBOOT`=false | |
75 | Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol. |
|
75 | Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol. | |
76 |
|
76 | |||
|
77 | ##### `ENABLE_FBTURBO`=false | |||
|
78 | Install and enable the hardware accelerated Xorg video driver `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling. | |||
|
79 | ||||
77 | ##### `ENABLE_IPTABLES`=false |
|
80 | ##### `ENABLE_IPTABLES`=false | |
78 | Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. |
|
81 | Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. | |
79 |
|
82 |
@@ -62,6 +62,7 ENABLE_FLUXBOX=${ENABLE_FLUXBOX:=false} | |||||
62 | # Advanced settings |
|
62 | # Advanced settings | |
63 | ENABLE_MINBASE=${ENABLE_MINBASE:=false} |
|
63 | ENABLE_MINBASE=${ENABLE_MINBASE:=false} | |
64 | ENABLE_UBOOT=${ENABLE_UBOOT:=false} |
|
64 | ENABLE_UBOOT=${ENABLE_UBOOT:=false} | |
|
65 | ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} | |||
65 | ENABLE_HARDNET=${ENABLE_HARDNET:=false} |
|
66 | ENABLE_HARDNET=${ENABLE_HARDNET:=false} | |
66 | ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} |
|
67 | ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} | |
67 |
|
68 | |||
@@ -74,7 +75,7 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstool | |||||
74 | # Missing packages that need to be installed |
|
75 | # Missing packages that need to be installed | |
75 | MISSING_PACKAGES="" |
|
76 | MISSING_PACKAGES="" | |
76 |
|
77 | |||
77 | # Packages required in the chroot build enviroment |
|
78 | # Packages required in the chroot build environment | |
78 | APT_INCLUDES="apt-transport-https,ca-certificates,debian-archive-keyring,dialog,sudo" |
|
79 | APT_INCLUDES="apt-transport-https,ca-certificates,debian-archive-keyring,dialog,sudo" | |
79 |
|
80 | |||
80 | set +x |
|
81 | set +x | |
@@ -148,11 +149,17 if [ "$ENABLE_HWRANDOM" = true ] ; then | |||||
148 | APT_INCLUDES="${APT_INCLUDES},rng-tools" |
|
149 | APT_INCLUDES="${APT_INCLUDES},rng-tools" | |
149 | fi |
|
150 | fi | |
150 |
|
151 | |||
|
152 | # Add fbturbo video driver | |||
|
153 | if [ "$ENABLE_FBTURBO" = true ] ; then | |||
|
154 | # Enable xorg package dependencies | |||
|
155 | ENABLE_XORG=true | |||
|
156 | fi | |||
|
157 | ||||
151 | # Add fluxbox package with eterm |
|
158 | # Add fluxbox package with eterm | |
152 | if [ "$ENABLE_FLUXBOX" = true ] ; then |
|
159 | if [ "$ENABLE_FLUXBOX" = true ] ; then | |
153 | APT_INCLUDES="${APT_INCLUDES},fluxbox,eterm" |
|
160 | APT_INCLUDES="${APT_INCLUDES},fluxbox,eterm" | |
154 |
|
161 | |||
155 |
# Enable xorg package dependenc |
|
162 | # Enable xorg package dependencies | |
156 | ENABLE_XORG=true |
|
163 | ENABLE_XORG=true | |
157 | fi |
|
164 | fi | |
158 |
|
165 | |||
@@ -180,7 +187,7 cp /usr/bin/qemu-arm-static $R/usr/bin | |||||
180 | chroot $R mkdir -p /usr/share/keyrings |
|
187 | chroot $R mkdir -p /usr/share/keyrings | |
181 | cp /usr/share/keyrings/debian-archive-keyring.gpg $R/usr/share/keyrings/debian-archive-keyring.gpg |
|
188 | cp /usr/share/keyrings/debian-archive-keyring.gpg $R/usr/share/keyrings/debian-archive-keyring.gpg | |
182 |
|
189 | |||
183 |
# Complete the bootstrapping proc |
|
190 | # Complete the bootstrapping process | |
184 | chroot $R /debootstrap/debootstrap --second-stage |
|
191 | chroot $R /debootstrap/debootstrap --second-stage | |
185 |
|
192 | |||
186 | # Mount required filesystems |
|
193 | # Mount required filesystems | |
@@ -675,19 +682,25 if [ "$ENABLE_SSHD" = false ] ; then | |||||
675 | sed -e '/^#/! {/SSH/ s/^/# /}' -i $R/etc/iptables/ip6tables.rules 2> /dev/null |
|
682 | sed -e '/^#/! {/SSH/ s/^/# /}' -i $R/etc/iptables/ip6tables.rules 2> /dev/null | |
676 | fi |
|
683 | fi | |
677 |
|
684 | |||
|
685 | # Install gcc/c++ build environment inside the chroot | |||
|
686 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then | |||
|
687 | # Install minimal gcc/g++ build environment | |||
|
688 | LANG=C chroot $R apt-get install -q -y --force-yes --no-install-recommends linux-compiler-gcc-4.9-arm g++ make bc | |||
|
689 | fi | |||
|
690 | ||||
|
691 | # Fetch and build U-Boot bootloader | |||
678 | if [ "$ENABLE_UBOOT" = true ] ; then |
|
692 | if [ "$ENABLE_UBOOT" = true ] ; then | |
679 | # Fetch u-boot github |
|
693 | # Fetch U-Boot bootloader sources | |
680 | git -C $R/tmp clone git://git.denx.de/u-boot.git |
|
694 | git -C $R/tmp clone git://git.denx.de/u-boot.git | |
681 |
|
695 | |||
682 | # Install minimal gcc/g++ build environment and build u-boot inside chroot |
|
696 | # Build and install U-Boot inside chroot | |
683 | LANG=C chroot $R apt-get install -qq -y --force-yes --no-install-recommends linux-compiler-gcc-4.9-arm g++ make bc |
|
|||
684 | LANG=C chroot $R make -C /tmp/u-boot/ rpi_2_defconfig all |
|
697 | LANG=C chroot $R make -C /tmp/u-boot/ rpi_2_defconfig all | |
685 |
|
698 | |||
686 | # Copy compiled bootloader binary and set config.txt to load it |
|
699 | # Copy compiled bootloader binary and set config.txt to load it | |
687 | cp $R/tmp/u-boot/u-boot.bin $R/boot/firmware/ |
|
700 | cp $R/tmp/u-boot/u-boot.bin $R/boot/firmware/ | |
688 | printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> $R/boot/firmware/config.txt |
|
701 | printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> $R/boot/firmware/config.txt | |
689 |
|
702 | |||
690 |
# Set |
|
703 | # Set U-Boot command file | |
691 | cat <<EOM >$R/boot/firmware/uboot.mkimage |
|
704 | cat <<EOM >$R/boot/firmware/uboot.mkimage | |
692 | # Tell Linux that it is booting on a Raspberry Pi2 |
|
705 | # Tell Linux that it is booting on a Raspberry Pi2 | |
693 | setenv machid 0x00000c42 |
|
706 | setenv machid 0x00000c42 | |
@@ -705,10 +718,39 fatload mmc 0:1 \${kernel_addr_r} kernel7.img | |||||
705 | bootz \${kernel_addr_r} |
|
718 | bootz \${kernel_addr_r} | |
706 | EOM |
|
719 | EOM | |
707 |
|
720 | |||
708 |
# Generate |
|
721 | # Generate U-Boot image from command file | |
709 | LANG=C chroot $R mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi2 Boot Script" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr |
|
722 | LANG=C chroot $R mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi2 Boot Script" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr | |
|
723 | fi | |||
|
724 | ||||
|
725 | ||||
|
726 | # Fetch and build fbturbo Xorg driver | |||
|
727 | if [ "$ENABLE_FBTURBO" = true ] ; then | |||
|
728 | # Fetch fbturbo driver sources | |||
|
729 | git -C $R/tmp clone https://github.com/ssvb/xf86-video-fbturbo.git | |||
|
730 | ||||
|
731 | # Install Xorg build dependencies | |||
|
732 | LANG=C chroot $R apt-get install -q -y --no-install-recommends xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |||
|
733 | ||||
|
734 | # Build and install fbturbo driver inside chroot | |||
|
735 | LANG=C chroot $R /bin/bash -c "cd /tmp/xf86-video-fbturbo; autoreconf -vi; ./configure --prefix=/usr; make; make install" | |||
|
736 | ||||
|
737 | # Add fbturbo driver to Xorg configuration | |||
|
738 | cat <<EOM >$R/usr/share/X11/xorg.conf.d/99-fbturbo.conf | |||
|
739 | Section "Device" | |||
|
740 | Identifier "Allwinner A10/A13 FBDEV" | |||
|
741 | Driver "fbturbo" | |||
|
742 | Option "fbdev" "/dev/fb0" | |||
|
743 | Option "SwapbuffersWait" "true" | |||
|
744 | EndSection | |||
|
745 | EOM | |||
|
746 | ||||
|
747 | # Remove Xorg build dependencies | |||
|
748 | LANG=C chroot $R apt-get -q -y purge --auto-remove xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |||
|
749 | fi | |||
710 |
|
750 | |||
711 |
|
|
751 | # Remove gcc/c++ build environment from the chroot | |
|
752 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then | |||
|
753 | # Remove minimal gcc/c++ build environment | |||
712 | LANG=C chroot $R apt-get -y -q purge --auto-remove bc binutils cpp cpp-4.9 g++ g++-4.9 gcc gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.9-dev libgomp1 libisl10 libmpc3 libmpfr4 libstdc++-4.9-dev libubsan0 linux-compiler-gcc-4.9-arm linux-libc-dev make |
|
754 | LANG=C chroot $R apt-get -y -q purge --auto-remove bc binutils cpp cpp-4.9 g++ g++-4.9 gcc gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.9-dev libgomp1 libisl10 libmpc3 libmpfr4 libstdc++-4.9-dev libubsan0 linux-compiler-gcc-4.9-arm linux-libc-dev make | |
713 | fi |
|
755 | fi | |
714 |
|
756 |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant