@@ -24,7 +24,11 if [ "$BUILD_KERNEL" = true ] ; then | |||||
24 | temp_dir=$(sudo -u nobody mktemp -d) |
|
24 | temp_dir=$(sudo -u nobody mktemp -d) | |
25 |
|
25 | |||
26 | # Fetch current RPi2/3 kernel sources |
|
26 | # Fetch current RPi2/3 kernel sources | |
27 | sudo -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" |
|
27 | if [ -z "${KERNEL_BRANCH}" ] ; then | |
|
28 | sudo -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" | |||
|
29 | else | |||
|
30 | sudo -u nobody git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" | |||
|
31 | fi | |||
28 |
|
32 | |||
29 | # Copy downloaded kernel sources |
|
33 | # Copy downloaded kernel sources | |
30 | mv "${temp_dir}/linux" "${R}/usr/src/" |
|
34 | mv "${temp_dir}/linux" "${R}/usr/src/" | |
@@ -94,12 +98,12 if [ "$BUILD_KERNEL" = true ] ; then | |||||
94 | fi |
|
98 | fi | |
95 |
|
99 | |||
96 | # Cross compile kernel and modules |
|
100 | # Cross compile kernel and modules | |
97 |
make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" |
|
101 | make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_BIN_IMAGE}" modules dtbs | |
98 | fi |
|
102 | fi | |
99 |
|
103 | |||
100 | # Check if kernel compilation was successful |
|
104 | # Check if kernel compilation was successful | |
101 |
if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
105 | if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then | |
102 |
echo "error: kernel compilation failed! ( |
|
106 | echo "error: kernel compilation failed! (kernel image not found)" | |
103 | cleanup |
|
107 | cleanup | |
104 | exit 1 |
|
108 | exit 1 | |
105 | fi |
|
109 | fi | |
@@ -130,16 +134,23 if [ "$BUILD_KERNEL" = true ] ; then | |||||
130 |
|
134 | |||
131 | # Copy dts and dtb device tree sources and binaries |
|
135 | # Copy dts and dtb device tree sources and binaries | |
132 | mkdir "${BOOT_DIR}/overlays" |
|
136 | mkdir "${BOOT_DIR}/overlays" | |
133 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" |
|
137 | ||
|
138 | # Ensure the proper .dtb is located | |||
|
139 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |||
|
140 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" | |||
|
141 | else | |||
|
142 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb "${BOOT_DIR}/" | |||
|
143 | fi | |||
|
144 | ||||
134 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/" |
|
145 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/" | |
135 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" |
|
146 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" | |
136 |
|
147 | |||
137 | if [ "$ENABLE_UBOOT" = false ] ; then |
|
148 | if [ "$ENABLE_UBOOT" = false ] ; then | |
138 |
# Convert and copy |
|
149 | # Convert and copy kernel image to the boot directory | |
139 |
"${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
150 | "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
140 | else |
|
151 | else | |
141 |
# Copy |
|
152 | # Copy kernel image to the boot directory | |
142 |
install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
153 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
143 | fi |
|
154 | fi | |
144 |
|
155 | |||
145 | # Remove kernel sources |
|
156 | # Remove kernel sources | |
@@ -167,6 +178,3 else # BUILD_KERNEL=false | |||||
167 | cleanup |
|
178 | cleanup | |
168 | exit 1 |
|
179 | exit 1 | |
169 | fi |
|
180 | fi | |
170 | # Copy vmlinuz kernel to the boot directory |
|
|||
171 | install_readonly "${VMLINUZ}" "${BOOT_DIR}/${KERNEL_IMAGE}" |
|
|||
172 | fi |
|
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant