OrangePi PC 替代法完成Gentoo镜像制作

简介: Gentoo 是属于’极为简洁优秀超可定制性的类Unix’的Linux..Gentoo包管理系统的设计是模块化、可移植、易维护、灵活以及针对用户机器优化的。
  • Gentoo 是属于’极为简洁优秀超可定制性的类Unix’的Linux..
    Gentoo包管理系统的设计是模块化、可移植、易维护、灵活以及针对用户机器优化的。Gentoo维基百科

  • 很多人遇到Gentoo,都会选择放弃,折腾的话,很费力气的,从头到尾都是去编译。但是用Gentoo的玩家,都会蔑视用 Ubuntu的用户,觉得他们太低端了。

  • 今天我们不从编译的角度去构建 Gentoo For OrangePi PC,如果你想在你的树莓派上跑Gentoo,Gentoo官方还是提供了供树莓派使用的镜像。

  • 先决条件:

    • 储存卡(至少4G,更好8G以上)
    • OrangePi PC的Linux SD卡镜像(官方或者Armbian的都行)
    • Gentoo armv7a_hardfp stage3镜像 或者本地镜像的portage树的当前快照
  • 准备SD卡

    • 我们需要将引导加载程序和内核从映像传输到SD卡。引导加载程序驻留在第一个分区之前的未分区空间中,内核驻留在第一个分区中。
  • 复制引导加载程序和内核

    • 如果压缩图像,请解压缩。我们假设该图像称为Debian_jessie_mini.img,SD卡是/ dev / sdb。根据需要调整以配合您的配置。看图像分区结构:

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

在这种情况下,我们将直接复制图像,直到引导分区结束到microSD卡。


root #dd if=Debian_jessie_mini.img of=/dev/sdb count=172032

接下来,我们将删除上一个根分区的分区表条目,然后创建新的根和可选的交换分区。


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

  • 设置根分区
    我们假设根分区是/ dev / sdb2,交换分区是/ dev / sdb3。

使用标签“linux”和交换空间创建根文件系统。


root #mkfs.ext4 -L linux /dev/sdb2
root #mkswap /dev/sdb3

  • 将Gentoo安装到SD卡
    安装根分区并提取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映像支持多个电路板,请安装引导分区,并为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

现在从图像中提取内核模块并将其复制到Gentoo系统中:


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

  • 设置root密码

root #sed -i "s|root:\*|root:$(openssl passwd -1)|" /mnt/opipc/etc/shadow
Password:
Verifying - Password:

  • 在make.conf中设置编译器并生成标志

    CFLAGS="-O2 -pipe -march=armv7ve -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mtune=cortex-a7"
    CXXFLAGS="${CFLAGS}"
    MAKEOPTS="-j4"

  • 要通过调试ttl uart工作,请更改

s0:12345:respawn:/ sbin / agetty -L 9600 ttyS0 vt100


s0:12345:respawn:/ sbin / agetty -L -f /etc/issue.logo 115200 ttyS0 vt100

  • 现在卸载所有内容,将SD卡插入Orange Pi PC,然后打开电源。
相关文章
|
4月前
|
JSON 人工智能 Linux
Linux|centos7|终端录屏神器asciinema的部署和初步使用
Linux|centos7|终端录屏神器asciinema的部署和初步使用
86 0
|
4月前
|
Kubernetes Ubuntu 安全
Linux|科普扫盲帖|配置网络软件源---阿里云镜像仓库服务使用(centos,Ubuntu)
Linux|科普扫盲帖|配置网络软件源---阿里云镜像仓库服务使用(centos,Ubuntu)
552 0
|
7月前
|
Linux
kali/debian/snap-store debain/linux的软件商店下载
kali/debian/snap-store debain/linux的软件商店下载
106 0
|
8月前
|
机器学习/深度学习 Ubuntu 决策智能
ubuntu16.04中将自己的ubuntu做成镜像
ubuntu16.04中将自己的ubuntu做成镜像
312 0
|
Ubuntu 数据安全/隐私保护
安装Ubuntu16.04卡在Ubuntu的logo界面解决方法
安装Ubuntu16.04卡在Ubuntu的logo界面解决方法
安装Ubuntu16.04卡在Ubuntu的logo界面解决方法
|
Linux Apache Windows
Linux 制作系统镜像
Linux 制作系统镜像
Linux 制作系统镜像