##// END OF EJS Templates
u-boot fix...
Unknown -
r322:f7b1bd6e1d38
parent child
Show More
@@ -1,58 +1,60
1 1 #!/bin/bash
2 2 #
3 3 # Setup APT repositories
4 4 #
5 5
6 6 # Load utility functions
7 7 . ./functions.sh
8 8
9 9 # Install and setup APT proxy configuration
10 10 if [ -z "$APT_PROXY" ] ; then
11 11 install_readonly files/apt/10proxy "${ETC_DIR}/apt/apt.conf.d/10proxy"
12 12 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy"
13 13 fi
14 14
15 15 if [ "$BUILD_KERNEL" = false ] ; then
16 16 echo "Downloading precompiled kernel"
17 17 echo "error: not configured"
18 18 exit 1;
19 19 # BUILD_KERNEL=true
20 20 else
21 21 echo "No precompiled kernel repositories were added"
22 22 fi
23 23
24 24 #autconfigure best apt server to not spam ftp.debian.org
25 25 #rm files/apt/sources.list
26 26 #netselect-apt does not know buster yet
27 27 if [ "$RELEASE" = "buster" ] ; then
28 RELEASE=testing
28 RLS=testing
29 else
30 RLS="$RELEASE"
29 31 fi
30 32
31 33 if [ "$ENABLE_NONFREE" = true ] ; then
32 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "${ETC_DIR}/apt/sources.list" -d "$RELEASE"
34 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS"
33 35 else
34 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "${ETC_DIR}/apt/sources.list" -d "$RELEASE"
36 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS"
35 37 fi
36 38
37 39 #ipinfo=$(curl ipinfo.io | grep country )
38 40 #grep -o '\"[^"]*\"' $ipinfo | tr -d '"'
39 41 #grep -Po '"country":.*?[^\\]",' $(curl ipinfo.io | grep country )
40 42 #sed -i "s,http:,https:,g" "${ETC_DIR}/apt/sources.list"
41 43
42 44 # Upgrade package index and update all installed packages and changed dependencies
43 45 chroot_exec apt-get -qq -y update
44 46 chroot_exec apt-get -qq -y -u dist-upgrade
45 47
46 48 if [ "$APT_INCLUDES_LATE" ] ; then
47 49 chroot_exec apt-get -qq -y install "$(echo "$APT_INCLUDES_LATE" |tr , ' ')"
48 50 fi
49 51
50 52 if [ -d packages ] ; then
51 53 for package in packages/*.deb ; do
52 54 cp "$package" "${R}"/tmp
53 55 chroot_exec dpkg --unpack /tmp/"$(basename "$package")"
54 56 done
55 57 fi
56 58 chroot_exec apt-get -qq -y -f install
57 59
58 60 chroot_exec apt-get -qq -y check
@@ -1,98 +1,99
1 1 #!/bin/bash
2 2 #
3 3 # Build and Setup U-Boot
4 4 #
5 5
6 6 # Load utility functions
7 7 . ./functions.sh
8 8
9 9 # Fetch and build U-Boot bootloader
10 10 if [ "$ENABLE_UBOOT" = true ] ; then
11 11 # Install c/c++ build environment inside the chroot
12 12 chroot_install_cc
13 13
14 14 # Copy existing U-Boot sources into chroot directory
15 15 if [ -n "$UBOOTSRC_DIR" ] && [ -d "$UBOOTSRC_DIR" ] ; then
16 16 # Copy local U-Boot sources
17 17 cp -r "${UBOOTSRC_DIR}" "${R}/tmp"
18 18 else
19 19 # Create temporary directory for U-Boot sources
20 20 temp_dir=$(as_nobody mktemp -d)
21 21
22 22 # Fetch U-Boot sources
23 23 as_nobody git -C "${temp_dir}" clone "${UBOOT_URL}"
24 24
25 25 # Copy downloaded U-Boot sources
26 26 mv "${temp_dir}/u-boot" "${R}/tmp/"
27 27
28 28 # Set permissions of the U-Boot sources
29 29 chown -R root:root "${R}/tmp/u-boot"
30 30
31 31 # Remove temporary directory for U-Boot sources
32 32 rm -fr "${temp_dir}"
33 33 fi
34 34
35 35 # Build and install U-Boot inside chroot
36 36 chroot_exec make -j"${KERNEL_THREADS}" -C /tmp/u-boot/ "${UBOOT_CONFIG}" all
37 37
38 38 # Copy compiled bootloader binary and set config.txt to load it
39 39 install_exec "${R}/tmp/u-boot/tools/mkimage" "${R}/usr/sbin/mkimage"
40 40 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
41 41 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
42 42
43 if [ "$SET_ARCH" = 64 ] ; then
44 #add arm_64bit=1
45 #device_tree_address=0x100
46 #device_tree_end=0x8000
47 #to config.txt
48 echo "Setting up config.txt to boot 64bit uboot"
49 fi
50
51 43 # Install and setup U-Boot command file
52 44 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
53 45 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
46 #Set correkt KERNEL_IMAGE
47 sed -i "s/kernel7.img/$KERNEL_BIN_IMAGE/g" files/boot/uboot.mkimage
48 #Set correct DTB_FILE
49 sed -i "s/bcm2709-rpi-2-b.dtb/$DTB_FILE/g" files/boot/uboot.mkimage
54 50
55 51 if [ "$ENABLE_INITRAMFS" = true ] ; then
56 52 # Convert generated initramfs for U-Boot using mkimage
57 53 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"
58 54
59 55 # Remove original initramfs file
60 56 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
61 57
62 58 # Configure U-Boot to load generated initramfs
63 59 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
64 60 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
65 61 else # ENABLE_INITRAMFS=false
66 62 # Remove initramfs from U-Boot mkfile
67 63 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
68 64
69 65 if [ "$BUILD_KERNEL" = false ] ; then
70 66 # Remove dtbfile from U-Boot mkfile
71 67 sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage"
72 68 printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
73 69 else
74 70 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
75 71 fi
76 72 fi
77 73
78 # Set mkfile to use the correct dtb file
79 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
74 if [ "$SET_ARCH" = 64 ] ; then
75 echo "Setting up config.txt to boot 64bit uboot"
76 printf \n# Tell u-boot a 64bit kernel is used\narm_64bit=1\n" >> "${BOOT_DIR}/config.txt"
77 printf \n# Device tree start addr\ndevice_tree_address=0x100\n" >> "${BOOT_DIR}/config.txt"
78 printf \n# Device tree stop adrr\ndevice_tree_end=0x8000\n" >> "${BOOT_DIR}/config.txt"
79 #to config.txt
80 fi
80 81
81 82 # Set mkfile to use the correct mach id
82 83 if [ "$ENABLE_QEMU" = true ] ; then
83 84 sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage"
84 85 fi
85 86
86 87 # Set mkfile to use kernel image
87 88 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
88 89
89 90 # Remove all leading blank lines
90 91 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
91 92
92 93 # Generate U-Boot bootloader image
93 94 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
94 95
95 96 # Remove U-Boot sources
96 97 rm -fr "${R}/tmp/u-boot"
97 98 fi
98 99
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant