Currently, as Chroot still didn’t support some feature(forgot),so we still use a stupid approach to build Mate(on target):
- Build Ubuntu server ROM
- Burn to VIM
- install Mate Desktop(run a script)
- backup rootfs and tarball Mate ROMs manually.
Here paste the script for reference first, and we will keep researching:
#!/bin/sh
## Backup root file system
## Usage: run follows manualy
# 1) mount /dev/sda1 /media
# 2) /media/mate.sh <MAC-ADDRESS>
## Admin user
# To generate encrypted password:
# 1) password="khadas"
# 2) perl -e 'printf("%s\n", crypt($ARGV[0], "password"))' "$password"
useradd -m -p "pal8k5d7/m9GY" -s /bin/bash khadas
usermod -aG sudo,adm khadas
## Network
cp -a /etc/network/interfaces /etc/network/interfaces.orig
echo "auto eth0" >> /etc/network/interfaces
echo "iface eth0 inet dhcp" >> /etc/network/interfaces
ifconfig eth0 down
if [ -n "$1" ] ; then
echo "Mac address: $1"
ifconfig eth0 hw ether $1
else
echo "Use default Mac address: 00:15:18:01:81:32"
ifconfig eth0 hw ether 00:15:18:01:81:32
fi
ifconfig eth0 up
/etc/init.d/networking restart
#ifconfig
## Apt sources.list: add [universe] and [multiverse] repositories
sed -i "s/^# deb http/deb http/g" /etc/apt/sources.list
## Mirrors
cp -a /etc/apt/sources.list /etc/apt/sources.list.orig
sed -i "s/http:\/\/ports.ubuntu.com\/ubuntu-ports\//http:\/\/mirrors.ustc.edu.cn\/ubuntu-ports\//g" /etc/apt/sources.list
## Mate desktop
apt update
apt -y upgrade
apt -y install mate-desktop-environment ubuntu-mate-core
## Gnome-player
apt -y install gnome-mplayer
## Bluetooth menu
apt -y install bluetooth blueman
## Restore
apt clean
mv /etc/apt/sources.list.orig /etc/apt/sources.list
mv /etc/network/interfaces.orig /etc/network/interfaces
# TODO history -c
# TODO /var/log
## Done
echo "Done."
reboot
## backup rootfs.img
echo "Start to backup root file system ..."
dd if=/dev/rootfs of=/media/rootfs.img
sync
echo "Generating MD5 checksum:"
md5sum /media/rootfs.img > /media/rootfs.img.md5
## umount
sleep 3
umount /media