##// END OF EJS Templates
.
burnbabyburn -
r327:486b4ea08ef2
parent child
Show More
@@ -42,7 +42,7 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh
42 42
43 43 ## Supported parameters and settings
44 44 #### APT settings:
45 ##### `APT_SERVER`="ftp.debian.org"
45 ##### `APT_SERVER`="ftp.debian.org/debian"
46 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 48 ##### `APT_PROXY`=""
@@ -26,7 +26,7 if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then
26 26 fi
27 27
28 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}/debian"
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 31 # Copy qemu emulator binary to chroot
32 32 install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
@@ -30,7 +30,7 if [ "$BUILD_KERNEL" = true ] ; then
30 30 else
31 31 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
32 32 fi
33
33
34 34 # Copy downloaded kernel sources
35 35 cp -r "${temp_dir}/linux/"* "${R}/usr/src/linux/"
36 36
@@ -108,7 +108,7 if [ "$BUILD_KERNEL" = true ] ; then
108 108 echo "CONFIG_CRYPTO_CBC=y"
109 109 echo "CONFIG_CRYPTO_XTS=y"
110 110 echo "CONFIG_CRYPTO_SHA512=y"
111 echo "CONFIG_CRYPTO_MANAGER=y"
111 echo "CONFIG_CRYPTO_MANAGER=y"
112 112 } >> "${KERNEL_DIR}"/.config
113 113 fi
114 114 fi
@@ -172,6 +172,11 if [ "$BUILD_KERNEL" = true ] ; then
172 172 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
173 173 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
174 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 181 # Prepare boot (firmware) directory
177 182 mkdir "${BOOT_DIR}"
@@ -184,7 +189,7 if [ "$BUILD_KERNEL" = true ] ; then
184 189
185 190 # Prepare device tree directory
186 191 mkdir "${BOOT_DIR}/overlays"
187
192
188 193 # Ensure the proper .dtb is located
189 194 if [ "$KERNEL_ARCH" = "arm" ] ; then
190 195 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
@@ -9,6 +9,11
9 9 # Install and setup fstab
10 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 17 # Add usb/sda disk root partition to fstab
13 18 if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_CRYPTFS" = false ] ; then
14 19 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab"
@@ -42,18 +42,26 if [ "$BUILD_KERNEL" = true ] ; then
42 42 fi
43 43
44 44 # Setup firmware boot cmdline
45 if [ "$ENABLE_SPLITFS" = true ] ; then
46 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
45 if [ "$ENABLE_UBOOTUSB" = true ] ; then
46 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
47 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 53 fi
50 54
55
51 56 # Add encrypted root partition to cmdline.txt
52 57 if [ "$ENABLE_CRYPTFS" = true ] ; then
53 58 if [ "$ENABLE_SPLITFS" = true ] ; then
54 59 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
55 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 65 fi
58 66 fi
59 67
@@ -40,13 +40,8 if [ "$ENABLE_UBOOT" = true ] ; then
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 # 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 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 "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
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 46 if [ "$ENABLE_INITRAMFS" = true ] ; then
52 47 # Convert generated initramfs for U-Boot using mkimage
@@ -56,8 +51,9 if [ "$ENABLE_UBOOT" = true ] ; then
56 51 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
57 52
58 53 # Configure U-Boot to load generated initramfs
59 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"
54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
55
56 fi
61 57 else # ENABLE_INITRAMFS=false
62 58 # Remove initramfs from U-Boot mkfile
63 59 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
@@ -70,25 +66,31 if [ "$ENABLE_UBOOT" = true ] ; then
70 66 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
71 67 fi
72 68 fi
73
69
74 70 if [ "$SET_ARCH" = 64 ] ; then
75 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"
77 printf "\n# Tell u-boot a 64bit kernel is used\narm_64bit=1\n" >> "${BOOT_DIR}/config.txt"
78 printf "\n# Device tree start addr\ndevice_tree_address=0x100\n" >> "${BOOT_DIR}/config.txt"
79 printf "\n# Device tree stop adrr\ndevice_tree_end=0x8000\n" >> "${BOOT_DIR}/config.txt"
72
73 printf "\n# 64bit-mode" >> "${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"
75 printf "\narm_64bit=1" >> "${BOOT_DIR}/config.txt"
76 sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage"
80 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 84 # Set mkfile to use the correct mach id
83 85 if [ "$ENABLE_QEMU" = true ] ; then
84 86 sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage"
85 87 fi
86
88
87 89 # Set mkfile to use the correct dtb file
88 90 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
89 91
90 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 95 # Remove all leading blank lines
94 96 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
@@ -1,9 +1,8
1 deb http://ftp.debian.org/debian jessie main contrib
2 #deb-src http://ftp.debian.org/debian jessie main contrib
3
4 deb http://ftp.debian.org/debian/ jessie-updates main contrib
5 #deb-src http://ftp.debian.org/debian/ jessie-updates main contrib
6
7 #deb http://security.debian.org/ jessie/updates main contrib
8 #deb-src http://security.debian.org/ jessie/updates main contrib
1 # Debian packages for testing
2 deb http://mirror.united-gameserver.de/debian/ testing main contrib non-free
3 # Uncomment the deb-src line if you want 'apt-get source'
4 # to work with most packages.
5 deb-src http://mirror.united-gameserver.de/debian/ testing main contrib non-free
9 6
7 # Security updates for stable
8 # deb http://security.debian.org/ stable/updates main contrib non-free
@@ -1,5 +1,5
1 1 # Set device tree fdtfile
2 setenv dtbfile bcm2709-rpi-2-b.dtb
2 setenv dtbfile bcm2710-rpi-3-b.dtb
3 3
4 4 # Tell Linux that it is booting on a Raspberry Pi2/3
5 5 setenv machid 0x00000c42
@@ -8,7 +8,8 setenv machid 0x00000c42
8 8 saveenv
9 9
10 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 13 fatload mmc 0:1 ${fdt_addr_r} ${dtbfile}
13 14 fatload mmc 0:1 ${ramdisk_addr_r} ${initramfs}
14 15
@@ -206,14 +206,17 else
206 206 RLS="$RELEASE"
207 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 213 if [ "$ENABLE_NONFREE" = true ] ; then
212 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS"
214 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
213 215 else
214 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "${ETC_DIR}/apt/sources.list" -d "$RLS"
216 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
215 217 fi
216 APT_SERVER=$(grep -m 1 http /etc/apt/sources.list | cut -d ' ' -f 2)
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 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 222 if [ -n "$SET_ARCH" ] ; then
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant