diff --git a/README.md b/README.md index b0ac860..1e3d542 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ After it finishes, you can find your images in the `output` directory on your ho ### Known issues * BeagleBone images might not convert properly using this docker envirnoment due to permission issues: `mount: /mender-convert/output/embedded/rootfs: WARNING: device write-protected, mounted read-only.` +* Raspberrypi0w doesn't work with precompiled mender client (pls use --mender-client option to specify build one) ## Contributing diff --git a/convert-stage-4.sh b/convert-stage-4.sh index eaa186d..3139459 100755 --- a/convert-stage-4.sh +++ b/convert-stage-4.sh @@ -116,7 +116,7 @@ create_client_files() { /dev/mmcblk0 0x1000000 0x20000 EOF ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") cat <<- EOF > $mender_dir/fw_env.config /dev/mmcblk0 0x400000 0x4000 /dev/mmcblk0 0x800000 0x4000 @@ -182,7 +182,7 @@ install_files() { { log "\t'/boot/efi' mountpoint missing. Adding"; \ sudo install -d -m 755 ${primary_dir}/boot/efi; } ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") [ ! -d "$primary_dir/uboot" ] && \ { log "\t'/uboot' mountpoint missing. Adding"; \ sudo install -d -m 755 ${primary_dir}/uboot; } diff --git a/mender-convert b/mender-convert index eeacaf7..037c774 100755 --- a/mender-convert +++ b/mender-convert @@ -176,7 +176,7 @@ declare -a rootfs_partition_ids=("primary" "secondary") declare -a mender_disk_mappings declare -a raw_disk_mappings #Supported devices -declare -a supported_devices=("beaglebone" "raspberrypi3" "qemux86_64") +declare -a supported_devices=("beaglebone" "raspberrypi3" "qemux86_64" "raspberrypi0w") do_raw_disk_image_shrink_rootfs() { log "$step/$total Shrinking raw disk image root filesystem..." @@ -330,7 +330,7 @@ do_raw_disk_image_create_partitions() { "beaglebone") do_make_sdimg_beaglebone ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") do_make_sdimg_raspberrypi3 ;; "qemux86_64") @@ -556,7 +556,7 @@ do_install_bootloader_to_mender_disk_image() { update_test_config_file $device_type distro-feature "mender-grub" \ mount-location "\/boot\/efi" ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") stage_5_args="-m $mender_disk_image -d $device_type -b ${bootloader_toolchain} $keep" eval set -- " ${stage_5_args}" ${tool_dir}/rpi3-convert-stage-5.sh ${stage_5_args}|| ret=$? diff --git a/mender-convert-functions.sh b/mender-convert-functions.sh index 303fcbf..142257f 100755 --- a/mender-convert-functions.sh +++ b/mender-convert-functions.sh @@ -200,7 +200,7 @@ set_mender_disk_alignment() { local lvar_partition_alignment=${PART_ALIGN_8MB} local lvar_vfat_storage_offset=$lvar_partition_alignment ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") local lvar_partition_alignment=${PART_ALIGN_4MB} local lvar_uboot_env_size=$(( $lvar_partition_alignment * 2 )) local lvar_vfat_storage_offset=$(( $lvar_partition_alignment + $lvar_uboot_env_size )) @@ -693,7 +693,7 @@ set_fstab() { mountpoint="/boot/efi" blk_device=mmcblk0p ;; - "raspberrypi3") + "raspberrypi3"|"raspberrypi0w") mountpoint="/uboot" blk_device=mmcblk0p ;; diff --git a/rpi3-convert-stage-2.sh b/rpi-convert-stage-2.sh similarity index 100% rename from rpi3-convert-stage-2.sh rename to rpi-convert-stage-2.sh diff --git a/rpi3-convert-stage-5.sh b/rpi-convert-stage-5.sh similarity index 92% rename from rpi3-convert-stage-5.sh rename to rpi-convert-stage-5.sh index 3a9008b..eaf6ee5 100755 --- a/rpi3-convert-stage-5.sh +++ b/rpi-convert-stage-5.sh @@ -34,12 +34,18 @@ version() { # Takes following arguments: # # $1 - ARM toolchain +# $2 - RPI machine (raspberrypi3 or raspberrypi0w) build_uboot_files() { local CROSS_COMPILE=${1}- local ARCH=arm local branch="mender-rpi-2017.09" - local commit="988e0ec54" + local commit="9214bb597e" local uboot_repo_vc_dir=$uboot_dir/.git + local defconfig="rpi_3_32b_defconfig" + + if [ "$2" == "raspberrypi0" ]; then + defconfig="rpi_0_w_defconfig" + fi export CROSS_COMPILE=$CROSS_COMPILE export ARCH=$ARCH @@ -57,7 +63,7 @@ build_uboot_files() { git checkout $commit >> "$build_log" 2>&1 make --quiet distclean >> "$build_log" - make --quiet rpi_3_32b_defconfig >> "$build_log" 2>&1 + make --quiet $defconfig >> "$build_log" 2>&1 make --quiet >> "$build_log" 2>&1 make --quiet envtools >> "$build_log" 2>&1 @@ -88,6 +94,11 @@ build_uboot_files() { install_files() { local boot_dir=$1 local rootfs_dir=$2 + local kernel_img="kernel7.img" + + if [ "${device_type}" == "raspberrypi0w" ]; then + kernel_img="kernel.img" + fi log "\tInstalling U-Boot related files." @@ -118,12 +129,13 @@ install_files() { sudo ln -sf /dev/null ${rootfs_dir}/etc/systemd/system/udisks2.service # Extract Linux kernel and install to /boot directory on rootfs - sudo cp ${boot_dir}/kernel7.img ${rootfs_dir}/boot/zImage + sudo cp ${boot_dir}/${kernel_img} ${rootfs_dir}/boot/zImage # Replace kernel with U-boot and add boot script sudo mkdir -p ${rootfs_dir}/uboot - sudo cp ${bin_dir_pi}/u-boot.bin ${boot_dir}/kernel7.img + sudo cp ${bin_dir_pi}/u-boot.bin ${boot_dir}/${kernel_img} + sudo cp ${bin_dir_pi}/boot.scr ${boot_dir} sudo cp ${boot_dir}/config.txt ${output_dir}/config.txt @@ -181,7 +193,7 @@ do_install_bootloader() { cd $output_dir # Build patched U-Boot files. - build_uboot_files $bootloader_toolchain + build_uboot_files $bootloader_toolchain $device_type rc=$? cd $output_dir