【Tutorial】dd image for Zero (suit for windows&linux)


#1

It is a translation tutorial.

【Catalog】
1、file Introductions
2、write images
3、boot lichee zero
4、expand rootfs & add swap
5、know issues
6、ToDo
7、download address

【File Introductions】
pack_zero_img.sh -->pack script
minX_dd.tar.bz2 -->min system include Xorg
mindb_dd.tar.gz -->min Debian,include gcc,python, etc.
brpy_dd.tar.bz2 -->buildroot image,include python etc.(no gcc)
brmin_dd.tar.bz2 -->min buildroot
minmin_dd.tar.bz2 -->min Debian (almost nothing but apt)
lichee_zero_test_Debian_LXDE.tar.bz2 -->Debian with LXDE

All made based on Zepan’s rootfs, and they are Alpha version.

【write images】
MAKE SURE THE TF CARD DON’T CONTAIN IMPORTANT FILES!!!
unzip the downloaded images, use tar under linux, use 7zip(http://www.7-zip.org/download.html)under windows.
You can verify MD5 after unzip.
Use dd to write tf card under linux.
If you are use windows, please prepare TF card format(https://www.sdcard.org/downloads/formatter_4/eula_windows/)
and Win32 Diskimager(http://sourceforge.net/projects/win32diskimager/files/Archive/)。
You can refer to http://www.orangepi.org/Docs/SDcardinstallation.html

【boot lichee zero】
Prepare an usb-to-uart to watch boot information and log in. The system uart is UART0.
Powered by MicroUSB or 5V pins.
DO NOT REVERSE CONNECT 5V/GND PINS !!!

【expand rootfs & add swap】
After boot, terminal will reminder you input user name & password.
Please try root/toortoor,or root/licheepi
After log in, you can expand rootfs, do partion, and then use resize2fs. You can refer to raspberrypi’s script.
If you want test desktop image, you MUST OPEN SWAP!!!
Tutorial for add swap: 【Tutorial】Setup swap file for Zero

【know issues】
lichee_zero_test_Debian_LXDE can’t login with normal user.
lichee_zero_test_Debian_LXDE’s locale have some issues.
Image’s wifi ko is based on older kernel version, you need cover it by new ko. (http://pan.baidu.com/s/1cldXfC)

【ToDo】
Add new rtl8723bs ko to dd image.
Add wifi auto up script and so on.

【download address】
http://pan.baidu.com/s/1kVbsmQN

MoHenHM@163.com
QQ group,@Anonym


Having challenges getting started
Having challenges getting started
#2

Could you upload the image and the necessary files to Github or any other file hoster?
The page needs ages to load and when the side loaded completly I get an 404 Error…

Edit: The Uart0 is occupied by the SD-card or I’m wrong?
Atleast the schematics show that.
Uart1 is occupied by the I²C camera interface.
So only Uart2 would be available all the time.


#3

Hello,

To help with issue downloading from Baidu I have put up a English site providing the files for download:

https://licheepizero.us

Hope this helps!

Cheers!


#4

UART0 can be mux to SDC0 pins or two pins on the other side.
If camera is not used, UART1 is free.
UART2 is free.


#5

Thank you very much!


#6

This might need to be updated.

I followed these steps and I get an error.

  1. Download zero_imager and the image to write on SD (I got the mindb)
  2. Place the .tar image within the zero_imager.
  3. Within the folder of zero_imager make all script executables by chmod +x *.sh
  4. Run the following command : sudo ./write_all.sh /dev/sdb mindb

I get the following error:

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x51472203.

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 1: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 2: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 3: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 4: unknown command

Command (m for help): 
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-15333375, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15333375, default 15333375): 
Created a new partition 1 of type 'Linux' and of size 8 MiB.

Command (m for help): 

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (18432-15333375, default 18432): Last sector, +sectors or +size{K,M,G,T,P} (18432-15333375, default 15333375): 
Created a new partition 2 of type 'Linux' and of size 7.3 GiB.

Command (m for help): Disk /dev/sdb: 7.3 GiB, 7850688512 bytes, 15333376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x51472203

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        2048    18431    16384    8M 83 Linux
/dev/sdb2       18432 15333375 15314944  7.3G 83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

mkfs.fat 3.0.28 (2015-05-16)
mke2fs 1.42.13 (17-May-2015)
/dev/sdb2 contains a ext4 file system
	last mounted on Wed Aug 30 06:05:53 2017
Proceed anyway? (y,n) y
Creating filesystem with 1914368 4k blocks and 478608 inodes
Filesystem UUID: 9d511c25-2030-4ede-8ad7-ad0e90254a9f
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

512+0 records in
512+0 records out
524288 bytes (524 kB, 512 KiB) copied, 1.11794 s, 469 kB/s
389+1 records in
389+1 records out
398445 bytes (398 kB, 389 KiB) copied, 0.784625 s, 508 kB/s
###write partion 1 ok!

tar (child): rootfs-mindb.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
write ALL ok!
```
In my humble opinion there is an error on the `write_p2.sh` file since it is looking for a file named `rootfs-$2\.tar.gz` where `$2` is the name of the tar, so

* The tar downloaded was `mindb_dd.tar.gz` I had to remove the `_dd` of the file name.
* Modify the `write_p2.sh`.

**from:**
```
#!/bin/sh
sudo mount "$1"2 mnt &&\
#sudo cp -R game/* mnt/usr/games/
#sudo chmod 777 -R mnt/usr/games
sudo rm -rf mnt/* &&\
sudo tar xzvf rootfs-$2\.tar.gz -C mnt/ &&\
sudo umount "$1"2 &&\
./write_overlay.sh $1 $2 &&\
./write_swap.sh $1 &&\
sync &&\
echo "###write partion 2 ok!"
sudo umount mnt >/dev/null 2>&1
```
**to:** (note that I have deleted the `rootfs-` on line 6
```
#!/bin/sh
sudo mount "$1"2 mnt &&\
#sudo cp -R game/* mnt/usr/games/
#sudo chmod 777 -R mnt/usr/games
sudo rm -rf mnt/* &&\
sudo tar xzvf $2\.tar.gz -C mnt/ &&\
sudo umount "$1"2 &&\
./write_overlay.sh $1 $2 &&\
./write_swap.sh $1 &&\
sync &&\
echo "###write partion 2 ok!"
sudo umount mnt >/dev/null 2>&1
```

After doing that I got successfully this:
```

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x1768f2c6.

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 1: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 2: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 3: unknown command

Command (m for help): No partition is defined yet!
Could not delete partition 1

Command (m for help): 4: unknown command

Command (m for help): 
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-15333375, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-15333375, default 15333375): 
Created a new partition 1 of type 'Linux' and of size 8 MiB.

Command (m for help): 

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (18432-15333375, default 18432): Last sector, +sectors or +size{K,M,G,T,P} (18432-15333375, default 15333375): 
Created a new partition 2 of type 'Linux' and of size 7.3 GiB.

Command (m for help): Disk /dev/sdb: 7.3 GiB, 7850688512 bytes, 15333376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1768f2c6

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        2048    18431    16384    8M 83 Linux
/dev/sdb2       18432 15333375 15314944  7.3G 83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

mkfs.fat 3.0.28 (2015-05-16)
mke2fs 1.42.13 (17-May-2015)
/dev/sdb2 contains a ext4 file system
	last mounted on Wed Aug 30 06:30:28 2017
Proceed anyway? (y,n) y
Creating filesystem with 1914368 4k blocks and 478608 inodes
Filesystem UUID: 41d53a9e-411c-4a3e-94f1-3602b2568bd0
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

512+0 records in
512+0 records out
524288 bytes (524 kB, 512 KiB) copied, 1.09897 s, 477 kB/s
389+1 records in
389+1 records out
398445 bytes (398 kB, 389 KiB) copied, 0.755961 s, 527 kB/s
###write partion 1 ok!

mindb_dd/
mindb_dd/lichee_zero-mindb_alpha.dd
mindb_dd/md5sum
###write overlay rootfs ok!

128+0 records in
128+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.0991318 s, 1.4 GB/s
Setting up swapspace version 1, size = 128 MiB (134213632 bytes)
no label, UUID=7261b1ab-eece-462a-afb3-6d538ba8a0c5
###write swap ok!
```
Also @Zepan  is there a GitHub where I can submit some changes to those scripts?

Connecting LCD display AT050TN33
#7

Hi, dd image is directly write with dd command.(convenient for player).
Zero_imager is a script set to write every part of image.(convenient for developer).
you need download the rootfs-xxx.tar.gz from http://pan.baidu.com/s/1eR6uIsy, and put them in zero_image dir, then run: write_all.sh /dev/sdX name_of_your_image.


#8

In case of lichee_zero_test_Debian_LXDE image, I try to use it but I can’t log-in as “root”. Due to known issue, even root, we can not log-in? Or is there anyway to login. I tried with password “toortoor” and “licheepi”. If there is no way to use the test image, do I need to use minX_dd image to use GUI and then install the desktop (ex. LXDE) manually?

Kuni


#9

Hi khunita, did you find correct password of lichee_zero_test_Debian_LXDE image?
I can not log too…