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