系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > 機(jī)頂盒刷Debian

如何在機(jī)頂盒中刷入原生的Debian系統(tǒng)

時(shí)間:2015-09-28 14:39:02 作者:zhijie 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20150928/58746.html 手機(jī)查看 評(píng)論

  Debian系統(tǒng)雖然在國(guó)內(nèi)用得比較少,但是在國(guó)外是非常流行的Linux系統(tǒng)。其實(shí)Debian的用途非常廣泛。只要配置過關(guān),用戶甚至可以在機(jī)頂盒中刷入Debian系統(tǒng)。那么如何在機(jī)頂盒中刷入原生的Debian系統(tǒng)呢?一起來(lái)看一下。

如何在機(jī)頂盒中刷入原生的Debian系統(tǒng)

  下面是操作步驟:

  第一部分:

  進(jìn)入默認(rèn)的安卓系統(tǒng),通過 ttl,使用 root 賬戶直接掛載 nanda 分區(qū),獲取其中的 script.bin。如果你沒有 ttl 線,可以先嘗試用 adb 連接盒子,然后用 root 大師來(lái)獲取 root 權(quán)限,之后順序操作即可:先把盒子連接上 Wifi,然后 adb connect IPADDRESS,root?傊,就是為了獲取 script.bin。

  一、獲取 script.bin方法:

  # mkdir /sdcard/nanda

  # mount -t vfat /dev/block/nanda /sdcard/nanda

  # exit

  # adb pull /sdcard/nanda/script.bin

  二、取得 script.bin 后,如果要修改其中的節(jié)點(diǎn),那么需要 sunxi-tools:

  # git clone https://github.com/linux-sunxi/sunxi-tools

  # make

  。/bin2fex script.bin script.fex

  三、編輯 fex 文件,編輯后,重新生成二進(jìn)制文件:

  。/fex2bin script.fex script.bin

  script.bin 文件是 fex 文件的二進(jìn)制實(shí)現(xiàn),fex 文件定義 SoC 是如何工作的,它配置 GPIO 引腳并設(shè)置 DRAM、顯示(如 HDMI、VGA、分辨率)等參數(shù)。

  第二部分:

  1、編譯 uboot

  這邊的編譯環(huán)境為 Linux version 3.16.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04),默認(rèn)的編譯工具為 gcc-arm-linux-gnueabihf,在“deb https://emdebian.org/tools/debian/ jessie main”源中可以找到。

  因?yàn)槲疫@邊沒有也找不到盒子的 uboot 源碼,我嘗試用了 cubieboard2 的 uboot 源碼,編譯后可以正常使用。

  git clone https://github.com/linux-sunxi/u-boot-sunxi -b wip/a20

  make cubieboard2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

  找一個(gè) SD 卡,用來(lái)引導(dǎo),全志盒子默認(rèn)為 SD 卡引導(dǎo)。用 fdisk 給 SD 卡分兩個(gè)區(qū),第一個(gè)為 fat,第二個(gè)為 ext4 格式,具體不再贅述。按照我的是 sdb1、sdb2。

  將編譯好的 uboot 寫入到 sdcard:

  # dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8

  # dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32

  新建一個(gè) boot.cmd 文件,輸入以下內(nèi)容:

  setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait

  panic=10 ${extra}

  fatload mmc 0 0x48000000 uImage

  bootm 0x48000000

  使用 cmd 文件來(lái)生成 scr 文件:

  mkimage -C none -A arm -T script -d boot.cmd boot.scr

  2、編譯內(nèi)核

  依舊使用 cubieboard2 的內(nèi)核,因?yàn)槲沂褂?Sunxi 的內(nèi)核編譯后無(wú)法啟動(dòng),本人菜鳥折騰了幾天沒精力了。直接使用 cubieboard2 的內(nèi)核可以啟動(dòng),但是需要添加盒子的 PHY 網(wǎng)卡驅(qū)動(dòng)。天敏電視精靈 3 的 PHY 為 ICplus 芯片。如下操作:

  # git clone https://github.com/cubieboard2/linux-sunxi

  # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig

  # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

  進(jìn)入 menuconfig 狀態(tài),添加 ICplus 網(wǎng)卡的支持:

  # make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules

  # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install

  生成的內(nèi)核和模塊路徑:

  arch/arm/boot/uImage

  output/lib/

  制作 Debian rootfs:

  # debootstrap --verbose --arch=armhf --foreign jessie debian https://ftp.cn.debian.org/debian

  # cd debian

  # cp /usr/bin/qemu-arm-static usr/bin/

  # LC_ALL=C LANGUAGE=C LANG=C chroot 。 /debootstrap/debootstrap --second-stage

  # LC_ALL=C LANGUAGE=C LANG=C chroot 。 dpkg --configure -a

  chroot 并部署 rootfs:

  passwd

  echo “a20” 》 etc/hostname

  echo “127.0.0.1 a20” 》》 etc/hostname

  echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 》》 etc/inittab

  echo deb https://ftp.cn.debian.org/debian/ jessie main contrib non-free 》 etc/apt/sources.list

  echo deb https://security.debian.org/ jessie/updates main contrib non-free 》》 etc/apt/sources.list

  apt-get update

  apt-get dist-upgrade

  apt-get install openssh-server

  apt-get install locales

  echo “en_US.UTF-8 UTF-8” 》 etc/locale.gen

  echo “zh_CN.UTF-8 UTF-8” 》》 etc/locale.gen

  locale-gen

  需要修改 rootfs 下的兩個(gè)文件 /etc/network/interfaces 和 /etc/ssh/sshd_config,開啟靜態(tài) ip 地址和支持 root 登錄。

  所有的制作完成了,下面拷貝文件到 SD 卡相應(yīng)分區(qū):

  拷貝到 sdb1 下的文件:

  uImage script.bin boot.scr

  然后將 Debian 的 rootfs 文件拷貝到 sdb2,內(nèi)核模塊拷貝到 /lib 下。

  插入 SD 卡到盒子,通電后等待片刻即可用 ssh 登錄盒子了,一個(gè)完整原生的 Debian 系統(tǒng)跑起來(lái)了。

  目前先研究到這里,使用 /dev/fb0 應(yīng)該可以繼續(xù)啟動(dòng) Xorg,跑跑 LXDE 應(yīng)該沒什么問題。

  以上就是在機(jī)頂盒中刷入Debian系統(tǒng)的方法了,雖然在機(jī)頂盒中的Debian系統(tǒng)還不能運(yùn)行大型的軟件,但是讓機(jī)頂盒功能變豐富還是很容易得。

發(fā)表評(píng)論

0

沒有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

掃碼關(guān)注
掃碼關(guān)注

掃碼關(guān)注 官方交流群 軟件收錄