##// 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 ## 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}/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 # 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}"
@@ -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}"
@@ -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,17 +42,25 if [ "$BUILD_KERNEL" = true ] ; then
42 fi
42 fi
43
43
44 # Setup firmware boot cmdline
44 # Setup firmware boot cmdline
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 else
45 if [ "$ENABLE_SPLITFS" = true ] ; then
48 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"
49 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
47 else
50 else
48 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
51 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
49 fi
52 fi
53 fi
54
50
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
61 if [ "$ENABLE_UBOOTUSB" = true ] ; then
62 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
63 else
56 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
64 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
57 fi
65 fi
58 fi
66 fi
@@ -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 "${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 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 "${BOOT_DIR}"/uboot.mkimage)" > "${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"
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"
@@ -73,12 +69,18 if [ "$ENABLE_UBOOT" = true ] ; then
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 printf "\n# Tell u-boot a 64bit kernel is used\narm_64bit=1\n" >> "${BOOT_DIR}/config.txt"
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"
@@ -88,7 +90,7 if [ "$ENABLE_UBOOT" = true ] ; then
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 #deb-src http://ftp.debian.org/debian/ jessie-updates main contrib
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 bcm2709-rpi-2-b.dtb
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 "${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 else
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 fi
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 #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