Use ext4 for /boot partition on Phicomm N1

Be careful when doing this, I suggest you backup your data before reformatting your /boot as ext4. Any mistake you make would potentially require a reflash of your device (or booting from USB stick to repair, at least).

Theoretically this also applies to boxes running Armbian as well as many other devices that use U-boot to boot the system.

U-boot (used by Phicomm N1 as well as many other ARM boards) itself supports loading files from ext4 filesystem. Therefore it’s possible to use ext4 as /boot‘s filesystem even if Armbian defaults this to vfat.

Note that it was reported that U-boot had issues of being slow when reading files from ext4 partitions in certain scenarios, but that’s not the case on Phicomm N1 (at least not for me). The reason could be that either Phicomm N1 is using a newer version of U-boot (IIRC N1 is using U-boot 2015+) or the files I’m placing on /boot does not span over 4 extents.

To use ext4 for /boot, the following steps need to be performed:

  1. Ensure your device is booting though firmware environment variable start_emmc_autoscript by fw_printenv start_emmc_autoscript. If you got nothing or an error from this command, you might need to reset start_autoscript by:

  2. Instruct U-boot to load start script from an ext4 partition instead of a vfat partition. This could be done by changing firmware variable start_emmc_autoscript (I would suggest you back up the variable by saving fw_printenv‘s output beforehand.):

    You might want to check out this if fw_printenv / fw_setenv does not work on your device.

  3. Use ext4load instead of fatload in file /boot/emmc_autoscript, which is used by start_emmc_autoscript variable we changed in step 1.

    Generally you should already have a file named emmc_autoscript.cmd in /boot, and you would want to s/fatload/ext4load/g it. But even if you don’t, the following one should work:

    emmc_autoscript could then be built by executing this:

  4. Backup /boot, reformat /dev/mmcblk1p1 as ext4 and copy files that were in /boot back.

    You might also need to re-label the partition if you’re using its parition label in /etc/fstab to mount it (Armbian defaults to mount /boot with LABEL=BOOT_EMMC in /etc/fstab).

  5. (Optional) Mark partition type of /dev/mmcblk1p1 as Linux:

    DO NOT REBOOT THE SYSTEM EVEN IF SFDISK ASKS YOU TO. REBOOT THE SYSTEM ONLY AFTER YOU PERFORMED ALL THE STEPS BELOW, OR YOU WILL BRICK YOUR DEVICE.

    If you’re not sure whether you’d want to perform this step, skip ahead, it won’t hurt.

    This mark is not used by the filesystem driver, it’s only a mark. This step is not necessary if you don’t mind sfdisk -l list /dev/mmcblk1p1 as W95 FAT32 (LBA).

    This is what sfdisk -l would look like if you don’t perform this step:

    This is what it would look like if you do peform this step:

  6. Remember to update filesystem type for /boot specified in /etc/fstab.

Run reboot now, and now the device should be booted from the ext4 /boot partition:

Leave a Reply

Your email address will not be published.