Gentoo 是屬于’極為簡(jiǎn)潔優(yōu)秀超可定制性的類(lèi)Unix’的Linux..
Gentoo包管理系統(tǒng)的設(shè)計(jì)是模塊化、可移植、易維護(hù)、靈活以及針對(duì)用戶(hù)機(jī)器優(yōu)化的。Gentoo維基百科很多人遇到Gentoo,都會(huì)選擇放棄,折騰的話(huà),很費(fèi)力氣的,從頭到尾都是去編譯。但是用Gentoo的玩家,都會(huì)蔑視用 Ubuntu的用戶(hù),覺(jué)得他們太低端了。
今天我們不從編譯的角度去構(gòu)建 Gentoo For OrangePi PC,如果你想在你的樹(shù)莓派上跑Gentoo,Gentoo官方還是提供了供樹(shù)莓派使用的鏡像。
-
先決條件:
- 儲(chǔ)存卡(至少4G,更好8G以上)
- OrangePi PC的Linux SD卡鏡像(官方或者Armbian的都行)
- Gentoo armv7a_hardfp stage3鏡像 或者本地鏡像的portage樹(shù)的當(dāng)前快照
-
準(zhǔn)備SD卡
- 我們需要將引導(dǎo)加載程序和內(nèi)核從映像傳輸?shù)絊D卡。引導(dǎo)加載程序駐留在第一個(gè)分區(qū)之前的未分區(qū)空間中,內(nèi)核駐留在第一個(gè)分區(qū)中。
-
復(fù)制引導(dǎo)加載程序和內(nèi)核
- 如果壓縮圖像,請(qǐng)解壓縮。我們假設(shè)該圖像稱(chēng)為Debian_jessie_mini.img,SD卡是/ dev / sdb。根據(jù)需要調(diào)整以配合您的配置。看圖像分區(qū)結(jié)構(gòu):
root #fdisk -l Debian_jessie_mini.img
Disk Debian_jessie_mini.img: 809 MiB, 848297984 bytes, 1656832 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: 0x9c2e57c2
Device Boot Start End Sectors Size Id Type
Debian_jessie_mini.img1 40960 172031 131072 64M b W95 FAT32
Debian_jessie_mini.img2 172032 1656832 1484801 725M 83 Linux
在這種情況下,我們將直接復(fù)制圖像,直到引導(dǎo)分區(qū)結(jié)束到microSD卡。
root #dd if=Debian_jessie_mini.img of=/dev/sdb count=172032
接下來(lái),我們將刪除上一個(gè)根分區(qū)的分區(qū)表?xiàng)l目,然后創(chuàng)建新的根和可選的交換分區(qū)。
root #fdisk /dev/sdb
Welcome to fdisk (util-linux 2.26.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-32372735, default 2048): 172032
Last sector, +sectors or +size{K,M,G,T,P} (2048-32372735, default 32372735):
(choose here the size for your root partition, repeat with the swap partition if you want one, then set the appropriate partition types)
Command (m for help): w
- 設(shè)置根分區(qū)
我們假設(shè)根分區(qū)是/ dev / sdb2,交換分區(qū)是/ dev / sdb3。
使用標(biāo)簽“l(fā)inux”和交換空間創(chuàng)建根文件系統(tǒng)。
root #mkfs.ext4 -L linux /dev/sdb2
root #mkswap /dev/sdb3
- 將Gentoo安裝到SD卡
安裝根分區(qū)并提取stage3 tarball和portage快照。
root #mkdir /mnt/opipc
root #mount /dev/sdb2 /mnt/opipc
root #tar xfa stage3-armv7a_hardfp-????????.tar.bz2 -C /mnt/opipc
root #tar xfa portage-latest.tar.xz -C /mnt/opipc/usr
如果原始的Linux映像支持多個(gè)電路板,請(qǐng)安裝引導(dǎo)分區(qū),并為Orange Pi PC選擇正確的uImage和script.bin。
root #mount /dev/sdb1 /mnt/opipc/boot
root #cp /mnt/opipc/boot/script.bin.OPI-PC_1080p60 /mnt/opipc/boot/script.bin
root #cp /mnt/opipc/boot/uImage_OPI-2 /mnt/opipc/boot/uImage
現(xiàn)在從圖像中提取內(nèi)核模塊并將其復(fù)制到Gentoo系統(tǒng)中:
root #mkdir /mnt/opipc_image
root #mount -o loop,offset=$((172032*512)) Debian_jessie_mini.img /mnt/opipc_image
root #cp -a /mnt/opipc_image/lib/modules /mnt/opipc/lib
- 最后完成配置
- 編輯 fstab
/ dev / mmcblk0p1 / boot vfat umask = 033 1 2
/ dev / mmcblk0p2 / ext4 defaults 0 1
/ dev / mmcblk0p3 none swap sw 0 0
- 設(shè)置root密碼
root #sed -i "s|root:\*|root:$(openssl passwd -1)|" /mnt/opipc/etc/shadow
Password:
Verifying - Password:
- 在make.conf中設(shè)置編譯器并生成標(biāo)志
CFLAGS="-O2 -pipe -march=armv7ve -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mtune=cortex-a7"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j4"
- 要通過(guò)調(diào)試ttl uart工作,請(qǐng)更改
s0:12345:respawn:/ sbin / agetty -L 9600 ttyS0 vt100
至
s0:12345:respawn:/ sbin / agetty -L -f /etc/issue.logo 115200 ttyS0 vt100
- 現(xiàn)在卸載所有內(nèi)容,將SD卡插入Orange Pi PC,然后打開(kāi)電源。