|
|
@ -19,11 +19,19 @@ function platform_modify() { |
|
|
|
run_and_log_cmd "wget -q ${RASPBERRYPI_BINARIES_URL} -P work/rpi/binaries" |
|
|
|
run_and_log_cmd "tar xvf work/rpi/binaries/${RASPBERRYPI_BINARIES} -C work/rpi/binaries" |
|
|
|
|
|
|
|
# By default, we modify cmdline.txt. |
|
|
|
# |
|
|
|
# In Ubuntu, the file is called btcmd.txt; if this file exists, use it instead |
|
|
|
CMDLINE="cmdline.txt" |
|
|
|
if [ -f work/boot/btcmd.txt ]; then |
|
|
|
CMDLINE="btcmd.txt" |
|
|
|
fi |
|
|
|
|
|
|
|
# Make a copy of Linux kernel arguments and modify. |
|
|
|
run_and_log_cmd "cp work/boot/cmdline.txt work/rpi/cmdline.txt" |
|
|
|
run_and_log_cmd "cp work/boot/$CMDLINE work/rpi/$CMDLINE" |
|
|
|
|
|
|
|
# Set a dynamic rootfs part (required for Mender A/B update strategy) |
|
|
|
run_and_log_cmd "sed -i 's/\b[ ]root=[^ ]*/ root=\${mender_kernel_root}/' work/rpi/cmdline.txt" |
|
|
|
run_and_log_cmd "sed -i 's/\b[ ]root=[^ ]*/ root=\${mender_kernel_root}/' work/rpi/$CMDLINE" |
|
|
|
|
|
|
|
# Root filesystem can not be resized when the disk is partition according |
|
|
|
# to Mender layout, where the rootfs partition is the not last one which |
|
|
@ -33,14 +41,14 @@ function platform_modify() { |
|
|
|
# cmdline.txt that are performed in the init_resize.sh script. |
|
|
|
# |
|
|
|
# Extracted from /usr/lib/raspi-config/init_resize.sh |
|
|
|
run_and_log_cmd "sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' work/rpi/cmdline.txt" |
|
|
|
run_and_log_cmd "sed -i 's| sdhci\.debug_quirks2=4||' work/rpi/cmdline.txt" |
|
|
|
if ! grep -q splash work/rpi/cmdline.txt; then |
|
|
|
run_and_log_cmd "sed -i 's/ quiet//g' work/rpi/cmdline.txt" |
|
|
|
run_and_log_cmd "sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' work/rpi/$CMDLINE" |
|
|
|
run_and_log_cmd "sed -i 's| sdhci\.debug_quirks2=4||' work/rpi/$CMDLINE" |
|
|
|
if ! grep -q splash work/rpi/$CMDLINE; then |
|
|
|
run_and_log_cmd "sed -i 's/ quiet//g' work/rpi/$CMDLINE" |
|
|
|
fi |
|
|
|
|
|
|
|
# Update Linux kernel command arguments with our custom configuration |
|
|
|
run_and_log_cmd "sudo cp work/rpi/cmdline.txt work/boot/" |
|
|
|
run_and_log_cmd "sudo cp work/rpi/$CMDLINE work/boot/" |
|
|
|
|
|
|
|
# Mask udisks2.service, otherwise it will mount the inactive part and we |
|
|
|
# might write an update while it is mounted which often result in |
|
|
@ -53,7 +61,10 @@ function platform_modify() { |
|
|
|
# Ubuntu Server images actually use U-boot by default on RPi3 and the |
|
|
|
# layout is slightly different on the boot partition. That is why we need |
|
|
|
# additional logic here to determine what we are converting. |
|
|
|
if [ -e work/boot/uboot.bin ] && [ -e work/boot/vmlinuz ]; then |
|
|
|
if [ -e work/boot/uboot_rpi_4_32b.bin ] && [ -e work/boot/vmlinuz ]; then |
|
|
|
RASPBERRYPI_KERNEL_IMAGE="vmlinuz" |
|
|
|
RASPBERRYPI_BOOTLOADER_IMAGE="uboot_rpi_4_32b.bin" |
|
|
|
elif [ -e work/boot/uboot.bin ] && [ -e work/boot/vmlinuz ]; then |
|
|
|
RASPBERRYPI_KERNEL_IMAGE="vmlinuz" |
|
|
|
RASPBERRYPI_BOOTLOADER_IMAGE="uboot.bin" |
|
|
|
else |
|
|
@ -74,7 +85,7 @@ function platform_modify() { |
|
|
|
# cases parse the options to determine the functionality. |
|
|
|
run_and_log_cmd "sudo ln -fs /uboot/config.txt work/rootfs/boot/config.txt" |
|
|
|
run_and_log_cmd "sudo ln -fs /uboot/overlays work/rootfs/boot/overlays" |
|
|
|
run_and_log_cmd "sudo ln -fs /uboot/cmdline.txt work/rootfs/boot/cmdline.txt" |
|
|
|
run_and_log_cmd "sudo ln -fs /uboot/$CMDLINE work/rootfs/boot/$CMDLINE" |
|
|
|
|
|
|
|
run_and_log_cmd "sudo install -m 755 work/rpi/binaries/fw_printenv work/rootfs/sbin/fw_printenv" |
|
|
|
run_and_log_cmd "sudo ln -fs /sbin/fw_printenv work/rootfs/sbin/fw_setenv" |
|
|
|