##// END OF EJS Templates
Updated: Use all CPU cores for uboot (from michaelfranzl PR)
drtyhlpr -
r133:eef6f5748506
parent child
Show More
@@ -1,68 +1,68
1 #
1 #
2 # Build and Setup U-Boot
2 # Build and Setup U-Boot
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install gcc/c++ build environment inside the chroot
8 # Install gcc/c++ build environment inside the chroot
9 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
9 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
10 COMPILER_PACKAGES=$(chroot_exec apt-get -s install ${COMPILER_PACKAGES} | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
10 COMPILER_PACKAGES=$(chroot_exec apt-get -s install ${COMPILER_PACKAGES} | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
11 chroot_exec apt-get -q -y --force-yes --no-install-recommends install ${COMPILER_PACKAGES}
11 chroot_exec apt-get -q -y --force-yes --no-install-recommends install ${COMPILER_PACKAGES}
12 fi
12 fi
13
13
14 # Fetch and build U-Boot bootloader
14 # Fetch and build U-Boot bootloader
15 if [ "$ENABLE_UBOOT" = true ] ; then
15 if [ "$ENABLE_UBOOT" = true ] ; then
16 # Fetch U-Boot bootloader sources
16 # Fetch U-Boot bootloader sources
17 git -C "${R}/tmp" clone "${UBOOT_URL}"
17 git -C "${R}/tmp" clone "${UBOOT_URL}"
18
18
19 # Build and install U-Boot inside chroot
19 # Build and install U-Boot inside chroot
20 chroot_exec make -C /tmp/u-boot/ ${UBOOT_CONFIG} all
20 chroot_exec make -j${KERNEL_THREADS} -C /tmp/u-boot/ ${UBOOT_CONFIG} all
21
21
22 # Copy compiled bootloader binary and set config.txt to load it
22 # Copy compiled bootloader binary and set config.txt to load it
23 install_exec "${R}/tmp/u-boot/tools/mkimage" "${R}/usr/sbin/mkimage"
23 install_exec "${R}/tmp/u-boot/tools/mkimage" "${R}/usr/sbin/mkimage"
24 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
24 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
25 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
25 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
26
26
27 # Install and setup U-Boot command file
27 # Install and setup U-Boot command file
28 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
28 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
29 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
29 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
30
30
31 if [ "$ENABLE_INITRAMFS" = true ] ; then
31 if [ "$ENABLE_INITRAMFS" = true ] ; then
32 # Convert generated initramfs for U-Boot using mkimage
32 # Convert generated initramfs for U-Boot using mkimage
33 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -T ramdisk -C none -n "initramfs-${KERNEL_VERSION}" -d "/boot/firmware/initramfs-${KERNEL_VERSION}" "/boot/firmware/initramfs-${KERNEL_VERSION}.uboot"
33 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -T ramdisk -C none -n "initramfs-${KERNEL_VERSION}" -d "/boot/firmware/initramfs-${KERNEL_VERSION}" "/boot/firmware/initramfs-${KERNEL_VERSION}.uboot"
34
34
35 # Remove original initramfs file
35 # Remove original initramfs file
36 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
36 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
37
37
38 # Configure U-Boot to load generated initramfs
38 # Configure U-Boot to load generated initramfs
39 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
39 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
40 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
40 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
41 else # ENABLE_INITRAMFS=false
41 else # ENABLE_INITRAMFS=false
42 # Remove initramfs from U-Boot mkfile
42 # Remove initramfs from U-Boot mkfile
43 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
43 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
44
44
45 if [ "$BUILD_KERNEL" = false ] ; then
45 if [ "$BUILD_KERNEL" = false ] ; then
46 # Remove dtbfile from U-Boot mkfile
46 # Remove dtbfile from U-Boot mkfile
47 sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage"
47 sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage"
48 printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
48 printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
49 else
49 else
50 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
50 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
51 fi
51 fi
52 fi
52 fi
53
53
54 # Set mkfile to use the correct dtb file
54 # Set mkfile to use the correct dtb file
55 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
55 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
56
56
57 # Set mkfile to use kernel image
57 # Set mkfile to use kernel image
58 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
58 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
59
59
60 # Remove all leading blank lines
60 # Remove all leading blank lines
61 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
61 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
62
62
63 # Generate U-Boot bootloader image
63 # Generate U-Boot bootloader image
64 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi${RPI_MODEL}" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
64 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi${RPI_MODEL}" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
65
65
66 # Remove U-Boot sources
66 # Remove U-Boot sources
67 rm -fr "${R}/tmp/u-boot"
67 rm -fr "${R}/tmp/u-boot"
68 fi
68 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant