EFlasher

From FriendlyELEC WiKi
Revision as of 06:10, 26 July 2018 by Yftan (Talk | contribs) (Backup & Restore Data on eMMC Flash)

Jump to: navigation, search

查看中文

1 Introduction to eFlasher

The eFlasher (eMMC-flasher) utility is released by FriendlyElec for users to install an OS image on a FriendlyElec board's eMMC easily.
The eFlasher utility provides users with a GUI with multiple OS options.
The eFlasher utility has two versions: eflasher-gui and eflasher-console:
1) eflasher-gui: a GUI based eFlasher utility. When a board is connected to an LCD or HDMI monitor users can use this utility to install an OS easily;
2) eflasher-console: a commandline based eFlasher utility. When a board is connected to a serial terminal or logged in with SSH users can use it to install an OS;

2 Install eFlasher

  • Step 1: download an eflasher installation package

Go to the wiki page of the nano board you bought and download an eflasher file named as :XXXX-eflasher-YYYYMMDD-full.img.7z(the "XXXX" is the board type for the board you bought and "YYYYMMDD" is the release date of that eflasher file)
This package contains all the image files released by FriendlyElec such as Debian, Android5, Android4.4 and Ubuntu core(different boards may be provided with different OS image files)
Download a XXXX-eflasher-YYYYMMDD-full.img.7z file to a PC host and make an installation SD card with a windows utility: win32diskimager.rar

  • Step 2: make an installation SD card with eflasher

Extract the eflasher file and you will get an ".img" file.Insert an SD card(at least 8G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card.
You can use "dd" under a Linux PC to flash this ".img" to your SD card too

  • Step 3: Start eFlasher

Insert this SD card to your board, press and hold the "BOOT" button, power on your board.

3 GUI Based eFlasher

By default after eFlash is started the GUI based version will be started. If your board is connected to an LCD or HDMI monitor you will see the following screen:

Eflasher-gui

Select your wanted OS to start installation.

4 Commandline Based eFlasher

If your board is not connected to any display device you can login your board via SSH and start the eflahser by running "eflasher". Here is what you expect to observe:

Eflasher-console


5 Automate OS Installation at System Startup

You can automate OS installation with eFlasher at system startup in three ways:

  • No.1:on the GUI based eFlasher select your wanted OS and check the "Start automatically at startup" option on the "Ready to Go" window.
  • No.2:mount an SD card to a Windows PC and create an "eflasher.conf" file with notepad on the FAT section of your SD card(or open an existing "eflasher.conf") and type the following lines if you want to install a Debian OS:
[General]
autoStart=/mnt/sdcard/debian

The "autoStart" field specifies the path to your ROM. In this example the ROM is a Debian OS image file.

  • No.3:after your board starts open a terminal and create or edit "/mnt/sdcard/eflasher.conf" and type the lines presented in No.2 .

6 Backup & Restore Data on eMMC Flash

This is pretty much like what the GHOST does with Windows. This function can either back up all the data on eMMC to an external storage device or copy all data from an external storage device to eMMC.

For mass production:
This is especially useful for a case in which you have made a system on a board and want to install this system to massive boards. This works for both Android and Linux images.

Prerequisites:
You need to have an external storage device whose storage is greater than the eMMC Flash. The external storage device should be formatted to exFat or ntfs. In some case eflasher may re-partition your external storage device.

6.1 Backup & Restore Data with GUI Utility

On eflasher's main window click on "Backup and Restore" and proceed with prompts:

Eflasher-console


6.2 Backup & Restore Data with Commandline Utility

Type the following command to start eflasher on an SSH or serial terminal:

# eflasher

You will see the following menu:

----------------------------------------------------------------------
  eflasher-console running on NanoPC-T3
----------------------------------------------------------------------
  Select an OS to Install:
    1) UbuntuCore arm64 with QtE
 
  Backup eMMC Flash to removable disk:
    bk) Start backup, use "nanopc-t3-emmc.raw" as the file name
 
  Restore eMMC flash from backup file:
    No backup file was found
----------------------------------------------------------------------
>>> Please choose (1/bk) :
bk

Type "bk" and enter to start data backup. All data will be saved in a file with the "raw" extension.

----------------------------------------------------------------------
  Backing up eMMC to /mnt/udisk/nanopc-t3-emmc.raw
----------------------------------------------------------------------
  Speed: 15.01 MB/s
  Remaining Time: 00:12:53
  [===========_______________________________________]  22%
----------------------------------------------------------------------
  >>>If you want to cancel, input "c" then press <Enter> key.

6.3 扩展功能

EFlasher允许你编写一些 Linux shell 脚本,来对 eMMC 的 boot分区或者根文件系统分区进行内容更改,比如:
1)增加个性化的开机LOGO
2)为板子分配静态的IP地址,或者MAC地址
3)通过网络更新数据,软件
4) 等等
EFlasher在完成对 eMMC 的恢复操作之后,自动执行你的脚本。
你的脚本需要放在一个单独的目录下,这个目录需要与备份文件同级,目录名称的命令规则是: 备份文件名+.d,例如 备份文件名是 xxxx.raw,则脚本目录名应为 xxxx.raw.d。
EFlasher 在默认情况下,会为你的备份文件生成一个清理脚本,其作用是对文件系统做一些常规的清理工作,例如清理 tmp 目录下的临时文件、var目录下的log等等。
你可以通过参考 EFlasher 生成的清理脚本来了解应该如何访问 eMMC 的boot分区和根分区。

root@NanoPC-T3:/mnt/udisk/nanopc-t3-emmc.raw.d# tree
.
|-- cleanup.sh
`-- README.txt
 
0 directories, 2 files
root@NanoPC-T3:/mnt/udisk/nanopc-t3-emmc.raw.d#

7 Make Your Own eFlasher

7.1 Manage Multiple OS Images with eFlasher

The eFlasher utility reads image files from the FAT section of an SD card. After an SD card is inserted to a Windows PC you can manage multiple OS images that exist in the SD card with eFlasher.
Under the FAT section of an SD card with multiple OS images each directory under the root directory contains an OS image. The name of such a directory should be named with letters or numbers
If the FAT section is not big enough to hold your multiple OS images you can store them in a USB drive with the same structure
For example there are four directories under the FAT section:
Eflasher-folder
They stand for four OS:
Eflasher-oslist

Files under an OS directory:
Configuration File:

env.conf environmental variables for setting up uboot and kernel parameters
info.conf system information:

title=Android 5 ---> OS name: Android 5
require-board=s5p4418 ---> SoC: S5P4418, options including S5P6818, H3, A64 etc
version=2016-11-17 ---> ROM's version number(or release date)
icon=androidos.png ---> icon
Here is a screenshot:
Eflasher-infoconf

Image File:

2ndboot.bin Second Boot
boot.img image file for boot section
bootloader U-Boot
cache.img image file for Android Cache section
system.img image file for system section
userdata.img image file for user data section
partmap.txt description file for partition map

These image files by default are included in an eFlasher file. These files can be downloaded from a board's corresponding wiki site. Usually an image file is located at the images-for-eflasher directory of a server. Here is how a S5P6818's directory looks like:

EImages-for-eflasher.png

You can download its image file and extract it to the FAT section of an SD card.

7.2 Make eflasher File with Your OS

Note: this only applies for 4418 and 6818 based boards
Here are the steps for making an eFlasher card with UbuntuCore for 4418 based boards:

git clone https://github.com/friendlyarm/sd-fuse_nanopi2.git
cd sd-fuse_nanopi2
sudo ./mkimage.sh eflasher
DEV=`sudo losetup -f`
sudo losetup ${DEV} s5p4418-eflasher-sd8g-$(date +%Y%m%d).img

If you make an eflasher card for 6818 based boards you need to change "sd-fuse_nanopi2.git" to "sd-fuse_nanopi3.git" and rename "s5p4418" to "s6p6818".

After these commands are successfully run an eflasher image named "s5p4418-eflasher-sd8g-YYYYMMDD.img" will be generated. But this image doesn't contain an OS file. Running the following commands will generate a UbuntuCore image file. You can use your OS image's file name to replace the "core-qte-images.tfz" to the following commands to insert your OS to the eflasher file:

sudo partprobe ${DEV}
sudo mkfs.vfat ${DEV}p1 -n FRIENDLYARM
sudo mkdir -p /mnt/fat
sudo mount -t vfat ${DEV}p1 /mnt/fat
sudo wget -qO- http://112.124.9.243/dvdfiles/S5P4418/images-for-eflasher/core-qte-images.tgz | tar xvz -C /mnt/fat
sudo umount /mnt/fat
sudo losetup -d ${DEV}

For 6818 based boards change "http://112.124.9.243/dvdfiles/S5P4418" to "http://112.124.9.243/dvdfiles/S5P6818".

After these commands are successfully run an "s5p4418-eflasher-sd8g-YYYYMMDD.img" file with a Ubuntu core OS image will be generated. You can use the "dd" command to flash it to an SD card and flash your OS to your board's eMMC.

7.3 Make Your Own OS Image

7.3.1 Make Android Image for 4418/6818

First of all you need to compile your Android source code. After compilation is finished enter the "out/target/product/XXXXX" directory ("XXXXX" stands for a product's name. For example 4418 SoC's name is "nanopi2" and 6818 SoC's name is "nanopi3") and replace the following file with the one under the Android directory of the FAT section of your SD card:

Eflasher-replace-files.png

7.3.2 Make Linux Image for 4418/6818/H3/H5

Refer to: Assembling_the_SD_card_image_yourself


8 Update Log

8.1 July-26-2017

  • Released English Version

8.2 August-22-2017

  • Added section 6.2

8.3 March-10-2018

  • Updated sections 6.2 and 6.3