[RK 3399][Android 7.1]デバッグノート---otapackageコンパイルに失敗


Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83
現象:otapackageをコンパイルし、以下のerrorを提示します.
creating system.img...
Running:  mkuserimg.sh -s /tmp/targetfiles-NuIdO9/system /tmp/system-2Ij3G9.img ext4 system 1610612736 -T 1230739200 -C /tmp/targetfiles-NuIdO9/META/filesystem_config.txt -B /tmp/system-blocklist-VRlLyR.map -L system /tmp/targetfiles-NuIdO9/META/file_contexts.bin
make_ext4fs -s -T 1230739200 -S /tmp/targetfiles-NuIdO9/META/file_contexts.bin -C /tmp/targetfiles-NuIdO9/META/filesystem_config.txt -B /tmp/system-blocklist-VRlLyR.map -L system -l 1610612736 -a system /tmp/system-2Ij3G9.img /tmp/targetfiles-NuIdO9/system
loaded 2900 fs_config entries
Creating filesystem with parameters:
    Size: 1610612736
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 6144
    Label: system
    Blocks: 393216
    Block groups: 12
    Reserved block group size: 95
Created filesystem with 2910/98304 inodes and 305246/393216 blocks
Running:  simg2img /tmp/system-2Ij3G9.img /tmp/unsparse_system-2Ij3G9.img
error: file_write: incomplete write
Cannot write output file
Traceback (most recent call last):
  File "./build/tools/releasetools/add_img_to_target_files", line 476, in 
    main(sys.argv[1:])
  File "./build/tools/releasetools/add_img_to_target_files", line 470, in main
    AddImagesToTargetFiles(args[0])
  File "./build/tools/releasetools/add_img_to_target_files", line 389, in AddImagesToTargetFiles
    boot_img=boot_image)
  File "./build/tools/releasetools/add_img_to_target_files", line 109, in AddSystem
    block_list=block_list)
  File "./build/tools/releasetools/add_img_to_target_files", line 118, in BuildSystem
    return CreateImage(input_dir, info_dict, "system", block_list=block_list)
  File "./build/tools/releasetools/add_img_to_target_files", line 211, in CreateImage
    assert succ, "build " + what + ".img image failed"
AssertionError: build system.img image failed
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1


原因:tmp対応パーティションスペース不足
kris@eco:~/rk3399/device/rockchip/rk3399$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.9G  4.0K  7.9G   1% /dev
tmpfs           1.6G  1.6M  1.6G   1% /run
/dev/sda1        14G  9.7G  3.7G  73% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M  4.0K  5.0M   1% /run/lock
none            7.9G  2.9M  7.9G   1% /run/shm
none            100M   80K  100M   1% /run/user
/dev/sda6       441G  275G  144G  66% /home
/dev/sdb1       459G  397G   39G  92% /home/kris/disk
/dev/sdc1        15G  1.2G   14G   8% /media/kris/66B9-B5BE

解決方法:パーティションサイズが十分であれば、/tmpディレクトリの下のファイルをクリアします.パーティションのサイズが足りない場合は、再パーティション化するしかありません.
参考:Breaks on build NBD 90 W#42