@@ -42,7 +42,7 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh | |||||
42 |
|
42 | |||
43 | ## Supported parameters and settings |
|
43 | ## Supported parameters and settings | |
44 | #### APT settings: |
|
44 | #### APT settings: | |
45 | ##### `APT_SERVER`="ftp.debian.org" |
|
45 | ##### `APT_SERVER`="ftp.debian.org/debian" | |
46 | Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. |
|
46 | Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. | |
47 |
|
47 | |||
48 | ##### `APT_PROXY`="" |
|
48 | ##### `APT_PROXY`="" |
@@ -26,7 +26,7 if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |||||
26 | fi |
|
26 | fi | |
27 |
|
27 | |||
28 | # Base debootstrap (unpack only) |
|
28 | # Base debootstrap (unpack only) | |
29 |
http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER} |
|
29 | http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}" | |
30 |
|
30 | |||
31 | # Copy qemu emulator binary to chroot |
|
31 | # Copy qemu emulator binary to chroot | |
32 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
|
32 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
@@ -30,7 +30,7 if [ "$BUILD_KERNEL" = true ] ; then | |||||
30 | else |
|
30 | else | |
31 | as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux |
|
31 | as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux | |
32 | fi |
|
32 | fi | |
33 |
|
33 | |||
34 | # Copy downloaded kernel sources |
|
34 | # Copy downloaded kernel sources | |
35 | cp -r "${temp_dir}/linux/"* "${R}/usr/src/linux/" |
|
35 | cp -r "${temp_dir}/linux/"* "${R}/usr/src/linux/" | |
36 |
|
36 | |||
@@ -108,7 +108,7 if [ "$BUILD_KERNEL" = true ] ; then | |||||
108 | echo "CONFIG_CRYPTO_CBC=y" |
|
108 | echo "CONFIG_CRYPTO_CBC=y" | |
109 | echo "CONFIG_CRYPTO_XTS=y" |
|
109 | echo "CONFIG_CRYPTO_XTS=y" | |
110 | echo "CONFIG_CRYPTO_SHA512=y" |
|
110 | echo "CONFIG_CRYPTO_SHA512=y" | |
111 |
echo "CONFIG_CRYPTO_MANAGER=y" |
|
111 | echo "CONFIG_CRYPTO_MANAGER=y" | |
112 | } >> "${KERNEL_DIR}"/.config |
|
112 | } >> "${KERNEL_DIR}"/.config | |
113 | fi |
|
113 | fi | |
114 | fi |
|
114 | fi | |
@@ -172,6 +172,11 if [ "$BUILD_KERNEL" = true ] ; then | |||||
172 | if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then |
|
172 | if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then | |
173 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install |
|
173 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install | |
174 | fi |
|
174 | fi | |
|
175 | # make tar.gz kernel package - missing os bzw. modules | |||
|
176 | #** ** ** WARNING ** ** ** | |||
|
177 | #Your architecture did not define any architecture-dependent files | |||
|
178 | #to be placed into the tarball. Please add those to ./scripts/package/buildtar . | |||
|
179 | # make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" targz-pkg | |||
175 |
|
180 | |||
176 | # Prepare boot (firmware) directory |
|
181 | # Prepare boot (firmware) directory | |
177 | mkdir "${BOOT_DIR}" |
|
182 | mkdir "${BOOT_DIR}" | |
@@ -184,7 +189,7 if [ "$BUILD_KERNEL" = true ] ; then | |||||
184 |
|
189 | |||
185 | # Prepare device tree directory |
|
190 | # Prepare device tree directory | |
186 | mkdir "${BOOT_DIR}/overlays" |
|
191 | mkdir "${BOOT_DIR}/overlays" | |
187 |
|
192 | |||
188 | # Ensure the proper .dtb is located |
|
193 | # Ensure the proper .dtb is located | |
189 | if [ "$KERNEL_ARCH" = "arm" ] ; then |
|
194 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |
190 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do |
|
195 | for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do |
@@ -9,6 +9,11 | |||||
9 | # Install and setup fstab |
|
9 | # Install and setup fstab | |
10 | install_readonly files/mount/fstab "${ETC_DIR}/fstab" |
|
10 | install_readonly files/mount/fstab "${ETC_DIR}/fstab" | |
11 |
|
11 | |||
|
12 | if [ "$ENABLE_UBOOTUSB" = true ] ; then | |||
|
13 | sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab" | |||
|
14 | sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/fstab" | |||
|
15 | fi | |||
|
16 | ||||
12 | # Add usb/sda disk root partition to fstab |
|
17 | # Add usb/sda disk root partition to fstab | |
13 | if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_CRYPTFS" = false ] ; then |
|
18 | if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_CRYPTFS" = false ] ; then | |
14 | sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab" |
|
19 | sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab" |
@@ -42,18 +42,26 if [ "$BUILD_KERNEL" = true ] ; then | |||||
42 | fi |
|
42 | fi | |
43 |
|
43 | |||
44 | # Setup firmware boot cmdline |
|
44 | # Setup firmware boot cmdline | |
45 |
if [ "$ENABLE_ |
|
45 | if [ "$ENABLE_UBOOTUSB" = true ] ; then | |
46 |
CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda |
|
46 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" | |
47 | else |
|
47 | else | |
48 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
48 | if [ "$ENABLE_SPLITFS" = true ] ; then | |
|
49 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" | |||
|
50 | else | |||
|
51 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" | |||
|
52 | fi | |||
49 | fi |
|
53 | fi | |
50 |
|
54 | |||
|
55 | ||||
51 | # Add encrypted root partition to cmdline.txt |
|
56 | # Add encrypted root partition to cmdline.txt | |
52 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
57 | if [ "$ENABLE_CRYPTFS" = true ] ; then | |
53 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
58 | if [ "$ENABLE_SPLITFS" = true ] ; then | |
54 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/") |
|
59 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/") | |
55 | else |
|
60 | else | |
56 | CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/") |
|
61 | if [ "$ENABLE_UBOOTUSB" = true ] ; then | |
|
62 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/") | |||
|
63 | else | |||
|
64 | CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/") | |||
57 | fi |
|
65 | fi | |
58 | fi |
|
66 | fi | |
59 |
|
67 |
@@ -40,13 +40,8 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
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 | # Install and setup U-Boot command file |
|
|||
44 | # Set correct KERNEL_IMAGE in mkfile |
|
|||
45 | sed -i "s/kernel7.img/$KERNEL_BIN_IMAGE/g" files/boot/uboot.mkimage |
|
|||
46 | # Set correct DTB_FILE |
|
|||
47 | sed -i "s/bcm2709-rpi-2-b.dtb/$DTB_FILE/g" files/boot/uboot.mkimage |
|
|||
48 | install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage" |
|
43 | install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage" | |
49 |
printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat |
|
44 | printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage" | |
50 |
|
45 | |||
51 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
46 | if [ "$ENABLE_INITRAMFS" = true ] ; then | |
52 | # Convert generated initramfs for U-Boot using mkimage |
|
47 | # Convert generated initramfs for U-Boot using mkimage | |
@@ -56,8 +51,9 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
56 | rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" |
|
51 | rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" | |
57 |
|
52 | |||
58 | # Configure U-Boot to load generated initramfs |
|
53 | # Configure U-Boot to load generated initramfs | |
59 |
printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat |
|
54 | printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage" | |
60 | printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" |
|
55 | ||
|
56 | fi | |||
61 | else # ENABLE_INITRAMFS=false |
|
57 | else # ENABLE_INITRAMFS=false | |
62 | # Remove initramfs from U-Boot mkfile |
|
58 | # Remove initramfs from U-Boot mkfile | |
63 | sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage" |
|
59 | sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage" | |
@@ -70,25 +66,31 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
70 | printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" |
|
66 | printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" | |
71 | fi |
|
67 | fi | |
72 | fi |
|
68 | fi | |
73 |
|
69 | |||
74 | if [ "$SET_ARCH" = 64 ] ; then |
|
70 | if [ "$SET_ARCH" = 64 ] ; then | |
75 | echo "Setting up config.txt to boot 64bit uboot" |
|
71 | echo "Setting up config.txt to boot 64bit uboot" | |
76 | printf "\n# Enable CPU 64 bit mode\narm_control=0x200\n" >> "${BOOT_DIR}/config.txt" |
|
72 | ||
77 |
|
|
73 | printf "\n# 64bit-mode" >> "${BOOT_DIR}/config.txt" | |
78 | printf "\n# Device tree start addr\ndevice_tree_address=0x100\n" >> "${BOOT_DIR}/config.txt" |
|
74 | printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md" >> "${BOOT_DIR}/config.txt" | |
79 | printf "\n# Device tree stop adrr\ndevice_tree_end=0x8000\n" >> "${BOOT_DIR}/config.txt" |
|
75 | printf "\narm_64bit=1" >> "${BOOT_DIR}/config.txt" | |
|
76 | sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage" | |||
80 | fi |
|
77 | fi | |
81 |
|
78 | |||
|
79 | if [ "$ENABLE_UBOOTUSB" = true ] ; then | |||
|
80 | sed -i "s|mmc|usb|g" "${BOOT_DIR}/uboot.mkimage" | |||
|
81 | fi | |||
|
82 | ||||
|
83 | ||||
82 | # Set mkfile to use the correct mach id |
|
84 | # Set mkfile to use the correct mach id | |
83 | if [ "$ENABLE_QEMU" = true ] ; then |
|
85 | if [ "$ENABLE_QEMU" = true ] ; then | |
84 | sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage" |
|
86 | sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage" | |
85 | fi |
|
87 | fi | |
86 |
|
88 | |||
87 | # Set mkfile to use the correct dtb file |
|
89 | # Set mkfile to use the correct dtb file | |
88 | sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage" |
|
90 | sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage" | |
89 |
|
91 | |||
90 | # Set mkfile to use kernel image |
|
92 | # Set mkfile to use kernel image | |
91 | sed "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage" |
|
93 | sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage" | |
92 |
|
94 | |||
93 | # Remove all leading blank lines |
|
95 | # Remove all leading blank lines | |
94 | sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage" |
|
96 | sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage" |
@@ -1,9 +1,8 | |||||
1 | deb http://ftp.debian.org/debian jessie main contrib |
|
1 | # Debian packages for testing | |
2 | #deb-src http://ftp.debian.org/debian jessie main contrib |
|
2 | deb http://mirror.united-gameserver.de/debian/ testing main contrib non-free | |
3 |
|
3 | # Uncomment the deb-src line if you want 'apt-get source' | ||
4 | deb http://ftp.debian.org/debian/ jessie-updates main contrib |
|
4 | # to work with most packages. | |
5 |
|
|
5 | deb-src http://mirror.united-gameserver.de/debian/ testing main contrib non-free | |
6 |
|
||||
7 | #deb http://security.debian.org/ jessie/updates main contrib |
|
|||
8 | #deb-src http://security.debian.org/ jessie/updates main contrib |
|
|||
9 |
|
6 | |||
|
7 | # Security updates for stable | |||
|
8 | # deb http://security.debian.org/ stable/updates main contrib non-free |
@@ -1,5 +1,5 | |||||
1 | # Set device tree fdtfile |
|
1 | # Set device tree fdtfile | |
2 |
setenv dtbfile bcm27 |
|
2 | setenv dtbfile bcm2710-rpi-3-b.dtb | |
3 |
|
3 | |||
4 | # Tell Linux that it is booting on a Raspberry Pi2/3 |
|
4 | # Tell Linux that it is booting on a Raspberry Pi2/3 | |
5 | setenv machid 0x00000c42 |
|
5 | setenv machid 0x00000c42 | |
@@ -8,7 +8,8 setenv machid 0x00000c42 | |||||
8 | saveenv |
|
8 | saveenv | |
9 |
|
9 | |||
10 | # Load the existing Linux kernel into RAM |
|
10 | # Load the existing Linux kernel into RAM | |
11 | fatload mmc 0:1 ${kernel_addr_r} kernel7.img |
|
11 | mmc dev 0 | |
|
12 | fatload mmc 0:1 ${kernel_addr_r} Image | |||
12 | fatload mmc 0:1 ${fdt_addr_r} ${dtbfile} |
|
13 | fatload mmc 0:1 ${fdt_addr_r} ${dtbfile} | |
13 | fatload mmc 0:1 ${ramdisk_addr_r} ${initramfs} |
|
14 | fatload mmc 0:1 ${ramdisk_addr_r} ${initramfs} | |
14 |
|
15 |
@@ -206,14 +206,17 else | |||||
206 | RLS="$RELEASE" |
|
206 | RLS="$RELEASE" | |
207 | fi |
|
207 | fi | |
208 |
|
208 | |||
209 | rm "${ETC_DIR}/apt/sources.list" |
|
209 | if [ -f "$(pwd)/files/apt/sources.list" ] ; then | |
|
210 | rm "$(pwd)/files/apt/sources.list" | |||
|
211 | fi | |||
210 |
|
212 | |||
211 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
213 | if [ "$ENABLE_NONFREE" = true ] ; then | |
212 |
netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "$ |
|
214 | netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" | |
213 | else |
|
215 | else | |
214 |
netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$ |
|
216 | netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" | |
215 | fi |
|
217 | fi | |
216 |
APT_SERVER=$(grep -m 1 http |
|
218 | APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3) | |
|
219 | APT_SERVER=${APT_SERVER::-1} | |||
217 |
|
220 | |||
218 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! |
|
221 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! | |
219 | if [ -n "$SET_ARCH" ] ; then |
|
222 | if [ -n "$SET_ARCH" ] ; then |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant