手機 - Motorola XT894 - Ubuntu - 安裝系統



參考資訊:
https://guidelinuxphone.wordpress.com/droid4-ubuntu-bring-up-rootfs/

步驟如下:
1. 下載檔案

$ sudo apt-get install fastboot
$ cd
$ wget https://maedevu.maemo.org/images/droid4/VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml.zip
$ wget https://maedevu.maemo.org/images/droid4/flash-droid-4-fw.sh
$ wget https://github.com/steward-fu/website/releases/download/xt894/droid4-kexecboot.img
$ wget https://github.com/steward-fu/website/releases/download/xt894/utags-mmcblk1p13.bin
$ unzip VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml.zip

2. 按住電源 + 音量上 + 音量下,選擇進入Fastboot模式
3. 安裝Kexecboot

$ pushd VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml
$ sudo bash ../flash-droid-4-fw.sh
$ popd
$ sudo fastboot flash mbm VRZ_XT894_9.8.2O-72_VZW-18-8_CFC.xml/allow-mbmloader-flashing-mbm.bin
$ sudo fastboot reboot-bootloader
$ sudo fastboot flash bpsw droid4-kexecboot.img
$ sudo fastboot flash utags utags-mmcblk1p13.bin
$ sudo fastboot reboot

4. 製作系統

$ sudo apt-get install qemu-user-static -y

$ cd
$ wget http://mirror.uchile.cl/ubuntu-cdimage/ubuntu-base/releases/18.04/release/ubuntu-base-18.04.2-base-armhf.tar.gz
$ git clone https://github.com/omerlle/droid4-bringup.git archives/droid4_bringup
$ git -C archives/droid4_bringup/ checkout ubuntu
$ export droid_rootfs="$PWD/rootfs/ubuntu/18.04.2-base-armhf"
$ mkdir -p ${droid_rootfs}
$ sudo tar -xzf ubuntu-base-18.04.2-base-armhf.tar.gz -C ${droid_rootfs}/
$ sudo rsync -a --chown=root:root archives/droid4_bringup/overlay/ ${droid_rootfs}
$ sudo cp /etc/resolv.conf ${droid_rootfs}/etc/
$ sudo cp -a /usr/bin/qemu-arm-static ${droid_rootfs}/usr/bin/
$ sudo mount -t proc /proc ${droid_rootfs}/proc
$ sudo mount -o bind /dev ${droid_rootfs}/dev
$ sudo chroot ${droid_rootfs}

# adduser droid4_user
# passwd root
# useradd -G sudo -m -s /bin/bash droid4_user
# echo droid4_user:1234 | chpasswd
# echo droid4 > /etc/hostname
# echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
# echo "127.0.0.1 droid4" >> /etc/hosts
# apt-get update
# apt-get upgrade
# apt-get install apt-utils language-pack-en-base python-gobject-2 libqmi-utils lsof rsync psmisc ifupdown udev vim openssh-server openssh-client net-tools ethtool wireless-tools network-manager iputils-ping rsyslog alsa-utils bash-completion resolvconf htop xinit xorg wpasupplicant tmux zsh eog evince sqlite3 bluez bluez-tools linux-firmware mpg123 sox libsox-fmt-all minicom emacs pulseaudio pulseaudio-module-bluetooth python3-evdev python3-pip xfce4 fvwm i3 kbd --no-install-recommends
# pip3 install evdev
# dpkg-reconfigure x11-common
# dpkg-reconfigure resolvconf
# sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# sqlite3 /root/.droid4/hardware.db < /usr/local/share/droid4/python3_packages/hardware/config/hardware_db.back
# sqlite3 /tmp/modem.db < /usr/local/share/droid4/python3_packages/modem/config/modem_db.back
# exit

$ sudo umount ${droid_rootfs}/dev
$ sudo umount ${droid_rootfs}/proc
$ sudo wget -c https://github.com/TI-ECS/bt-firmware/blob/master/am335x/TIInit_10.6.15.bts -P ${droid_rootfs}/lib/firmware/ti-connectivity

5. 燒錄到記憶卡(zImage、omap4-droid4-xt894.dtb需先編譯好)

$ export sdcard="mmcblk0"
$ set -u
$ mount | grep /dev/$sdcard | cut -d ' ' -f 3 | xargs umount echo "1 : start= 2048, size= 102400, type=83 2 : start= 104448, size= 8388608, type=83 3 : start= 8493056, size= $(($(cat /sys/block/$sdcard/size)-8493056)), type=83" | sudo sfdisk /dev/$sdcard
$ sudo partprobe /dev/${sdcard}
$ sudo mkfs.vfat /dev/${sdcard}p1 -n BOOT
$ sudo mkfs.ext4 /dev/${sdcard}p2 -L rootfs
$ sudo mkfs.vfat /dev/${sdcard}p3 -n USER_DATA
$ set +u
$ mkdir mnt

$ sudo mount /dev/${sdcard}p1 mnt
$ sudo mkdir -p mnt/boot
$ sudo rsync --chown=root:root archives/droid4_bringup/boot/boot.cfg mnt/boot
  ### sudo rsync --chown=root:root zImage omap4-droid4-xt894.dtb mnt/boot
$ sync
$ sudo umount mnt

$ sudo mount /dev/${sdcard}p2 mnt
$ sudo rsync --delete -av ${droid_rootfs}/ mnt/
  ### sudo make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=mnt/
$ sync
$ sudo umount mnt

$ sudo mount /dev/${sdcard}p3 mnt
$ sudo install -d mnt/droid4/modem/{dynamic_data,logs}
$ sudo mv ${droid_rootfs}/tmp/modem.db mnt/droid4/modem/dynamic_data/
$ sync
$ sudo umount mnt