Failed while writing the system to the SD card

Hi,
I compiled freedom-u-sdk with reference to the document step, then wrote the system to the SD card, and the following error occurred. I deleted partition by using the gdisk command before writing the file.

make[2]: Leaving directory ‘/share/zhuxuanlong/freedom-u-sdk/work/HiFive_U-Boot’
make[1]: Leaving directory ‘/share/zhuxuanlong/freedom-u-sdk/HiFive_U-Boot’
cd /share/zhuxuanlong/freedom-u-sdk/work/linux &&
/share/zhuxuanlong/freedom-u-sdk/linux/usr/gen_initramfs_list.sh
-o /share/zhuxuanlong/freedom-u-sdk/work/initramfs.cpio.gz -u 0 -g 0
/share/zhuxuanlong/freedom-u-sdk/conf/initramfs.txt
/share/zhuxuanlong/freedom-u-sdk/work/buildroot_initramfs_sysroot
/share/zhuxuanlong/freedom-u-sdk/work/HiFive_U-Boot/tools/mkimage -f /share/zhuxuanlong/freedom-u-sdk/conf/uboot-fit-image.its -A riscv -O linux -T flat_dt /share/zhuxuanlong/freedom-u-sdk/work/image-ddbe382-dirty.fit
FIT description: U-boot FIT image for HiFive Unleashed
Created: Thu Sep 19 16:21:37 2019
Image 0 (bbl)
Description: BBL/SBI/riscv-pk
Created: Thu Sep 19 16:21:37 2019
Type: Kernel Image
Compression: uncompressed
Data Size: 74266 Bytes = 72.53 KiB = 0.07 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x80000000
Entry Point: 0x80000000
Hash algo: sha256
Hash value: 5d0e0acfb368baa5b4681a580c3b3a8f4080735e80d0be1df219912f1bc7883e
Image 1 (kernel)
Description: Linux kernel
Created: Thu Sep 19 16:21:37 2019
Type: Kernel Image
Compression: uncompressed
Data Size: 10908332 Bytes = 10652.67 KiB = 10.40 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x80200000
Entry Point: unavailable
Hash algo: sha256
Hash value: 12f008f7da4c01f5fc2aab556f10cf922fe8b9a13ca1b342efe7d4eca90c8608
Image 2 (ramdisk)
Description: buildroot initramfs
Created: Thu Sep 19 16:21:37 2019
Type: RAMDisk Image
Compression: gzip compressed
Data Size: 4568936 Bytes = 4461.85 KiB = 4.36 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x82000000
Entry Point: unavailable
Hash algo: sha256
Hash value: 688028fd147adc15912a38dc26447df34bc5823a5c2c7bfb831218cbb8922946
Image 3 (fdt)
Description: unavailable
Created: Thu Sep 19 16:21:37 2019
Type: Flat Device Tree
Compression: uncompressed
Data Size: 15765 Bytes = 15.40 KiB = 0.02 MiB
Architecture: RISC-V
Load Address: 0x81f00000
Hash algo: sha256
Hash value: 90317bc02979b1681313c8df7f992801eeecc0600ae9e6d4e0f37ab5d1c6bbbb
Default Configuration: ‘config-1’
Configuration 0 (config-1)
Description: HiFive Unleashed with BBL
Kernel: bbl
FDT: fdt
Loadables: kernel
ramdisk
dd if=/dev/zero of=/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-vfat.part bs=512 count=63454
记录了63454+0 的读入
记录了63454+0 的写出
32488448 bytes (32 MB, 31 MiB) copied, 0.125393 s, 259 MB/s
/sbin/mkfs.vfat /share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-vfat.part
mkfs.fat 3.0.28 (2015-05-16)
PATH=/share/zhuxuanlong/freedom-u-sdk/work/buildroot_initramfs/host/bin:/usr/local/sbt/:/usr/local/sbt/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/Xilinx/Vivado/2018.2/bin:/opt/Xilinx/Vivado/2018.2/bin MTOOLS_SKIP_CHECK=1 mcopy -i /share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-vfat.part /share/zhuxuanlong/freedom-u-sdk/work/image-ddbe382-dirty.fit ::hifiveu.fit
PATH=/share/zhuxuanlong/freedom-u-sdk/work/buildroot_initramfs/host/bin:/usr/local/sbt/:/usr/local/sbt/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/Xilinx/Vivado/2018.2/bin:/opt/Xilinx/Vivado/2018.2/bin MTOOLS_SKIP_CHECK=1 mcopy -i /share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-vfat.part /share/zhuxuanlong/freedom-u-sdk/conf/uEnv.txt ::uEnv.txt
dd if=/dev/zero of=/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-ddbe382-dirty.gpt bs=1M count=32
记录了32+0 的读入
记录了32+0 的写出
33554432 bytes (34 MB, 32 MiB) copied, 0.0289218 s, 1.2 GB/s
/sbin/sgdisk --clear
–new=1:2048:65502 --change-name=1:“Vfat Boot” --typecode=1:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
–new=3:1100:2020 --change-name=3:uboot --typecode=3:5B193300-FC78-40CD-8002-E86C45580B47
–new=4:1024:1099 --change-name=4:uboot-env --typecode=4:a09354ac-cd63-11e8-9aff-70b3d592f0fa
/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-ddbe382-dirty.gpt
Creating new GPT entries.
Setting name!
partNum is 0
REALLY setting name!
Setting name!
partNum is 2
REALLY setting name!
Setting name!
partNum is 3
REALLY setting name!
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
dd conv=notrunc if=/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-vfat.part of=/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-ddbe382-dirty.gpt bs=512 seek=2048
记录了63454+0 的读入
记录了63454+0 的写出
32488448 bytes (32 MB, 31 MiB) copied, 0.116828 s, 278 MB/s
dd conv=notrunc if=/share/zhuxuanlong/freedom-u-sdk/work/HiFive_U-Boot/u-boot.bin of=/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-ddbe382-dirty.gpt bs=512 seek=1100 count=950
记录了908+1 的读入
记录了908+1 的写出
464941 bytes (465 kB, 454 KiB) copied, 0.00462758 s, 100 MB/s

GPT (for SPI flash or SDcard) and U-boot Image files have
been generated for an ISA of rv64imafdc and an ABI of lp64d

/share/zhuxuanlong/freedom-u-sdk/work/image-ddbe382-dirty.fit
/share/zhuxuanlong/freedom-u-sdk/work/hifive-unleashed-ddbe382-dirty.gpt

To completely erase, reformat, and program a disk sdX, run:
make DISK=/dev/sdX format-boot-loader
… you will need gdisk and e2fsprogs installed
Please note this will not currently format the SDcard ext4 partition
This can be done manually if needed

root@zte-R5300-G4:/share/zhuxuanlong/freedom-u-sdk# lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 446.1G 0 disk
sda1 8:1 0 63.5G 0 part /
sda5 8:5 0 382.6G 0 part [SWAP]
sdb 8:16 0 10.9T 0 disk
sdb1 8:17 0 10.9T 0 part /share
sdd 8:48 1 14.9G 0 disk
sr0 11:0 1 1024M 0 rom
root@zte-R5300-G4:/share/zhuxuanlong/freedom-u-sdk#

root@zte-R5300-G4:/share/zhuxuanlong/freedom-u-sdk# make DISK=/dev/sdd format-boot-loader
/sbin/sgdisk --clear
–new=1:2048:65502 --change-name=1:“Vfat Boot” --typecode=1:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
–new=2:264192:31114288 --change-name=2:root --typecode=2:0FC63DAF-8483-4772-8E79-3D69D8477DE4
–new=3:1100:2020 --change-name=3:uboot --typecode=3:5B193300-FC78-40CD-8002-E86C45580B47
–new=4:1024:1099 --change-name=4:uboot-env --typecode=4:a09354ac-cd63-11e8-9aff-70b3d592f0fa
/dev/sdd
Setting name!
partNum is 0
REALLY setting name!
Setting name!
partNum is 1
REALLY setting name!
Setting name!
partNum is 2
REALLY setting name!
Setting name!
partNum is 3
REALLY setting name!
The operation has completed successfully.
/sbin/partprobe
Error: Could not find bootloader partition for /dev/sdd
Makefile:384: recipe for target ‘format-boot-loader’ failed
make: *** [format-boot-loader] Error 1

Try looking at the Makefile to find the rule that failed. Try running the partprobe command by hand. Does it work? You should be able to see the disk partitions after this runs. What are the disk partition names? The Makefile expects that there will either be a /dev/sdd1, a /dev/sddp1, or a /dev/sdds1, after the partprobe command. If not, then you get the error you saw. Does one of those partitions exist? If not, do they exist on the sdcard? Try using fdisk or something to look at the card. Maybe ejecting and re-inserting the sdcard helps? If you can get the partitions mounted, you can always try running the dd commands by hand instead of using the makefile.

1 Like

It’s normal to re-execute unset RISCV.