##// END OF EJS Templates
Added ENABLE_UBOOT support
Jan Wagner -
r3:ed1f379a7abf
parent child
Show More
@@ -61,6 +61,7 ENABLE_XORG=${ENABLE_XORG:=false}
61 61 ENABLE_FLUXBOX=${ENABLE_FLUXBOX:=false}
62 62
63 63 # Advanced settings
64 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
64 65 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
65 66 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
66 67
@@ -68,7 +69,7 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
68 69 R=${BUILDDIR}/chroot
69 70
70 71 # Packages required for bootstrapping
71 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois"
72 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois git-core"
72 73
73 74 # Packages required in the chroot build enviroment
74 75 APT_INCLUDES="apt-transport-https,ca-certificates,debian-archive-keyring,dialog,locales,apt-utils,vim-tiny"
@@ -235,10 +236,6 LANG=C chroot $R usermod -a -G sudo -p "${ENCRYPTED_PASSWORD}" pi
235 236 # Set up root password
236 237 LANG=C chroot $R usermod -p "${ENCRYPTED_PASSWORD}" root
237 238
238 # Clean cached downloads
239 LANG=C chroot $R apt-get -y clean
240 LANG=C chroot $R apt-get -y autoclean
241 LANG=C chroot $R apt-get -y autoremove
242 239
243 240 # Set up interfaces
244 241 cat <<EOM >$R/etc/network/interfaces
@@ -632,6 +629,48 EOM
632 629 fi
633 630 fi
634 631
632 if [ "$ENABLE_UBOOT" = true ] ; then
633 # Fetch u-boot github
634 git -C $R/tmp clone git://git.denx.de/u-boot.git
635
636 # Install minimal gcc/g++ build enviroment and build u-boot inside chroot
637 LANG=C chroot $R apt-get install -y --force-yes --no-install-recommends linux-compiler-gcc-4.9-arm g++ make bc
638 LANG=C chroot $R make -C /tmp/u-boot/ rpi_2_defconfig all
639
640 # Copy compiled bootloader binary and set config.txt to load it
641 cp $R/tmp/u-boot/u-boot.bin $R/boot/firmware/
642 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> $R/boot/firmware/config.txt
643
644 # Set u-boot command file
645 cat <<EOM >$R/boot/firmware/uboot.mkimage
646 # Tell Linux that it is booting on a Raspberry Pi2
647 setenv machid 0x00000c42
648
649 # Set the kernel boot command line
650 setenv bootargs "earlyprintk ${CMDLINE}"
651
652 # Save these changes to u-boot's environment
653 saveenv
654
655 # Load the existing Linux kernel into RAM
656 fatload mmc 0:1 \${kernel_addr_r} kernel7.img
657
658 # Boot the kernel we have just loaded
659 bootz \${kernel_addr_r}
660 EOM
661
662 # Generate u-boot image from command file
663 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
664
665 # Remove gcc/c++ build enviroment
666 LANG=C chroot $R apt-get purge -y 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
667 fi
668
669 # Clean cached downloads
670 LANG=C chroot $R apt-get -y clean
671 LANG=C chroot $R apt-get -y autoclean
672 LANG=C chroot $R apt-get -y autoremove
673
635 674 # Unmount mounted filesystems
636 675 umount -l $R/proc
637 676 umount -l $R/sys
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant