debootstrap制作arm64根文件系统

本文详细介绍了如何在Debian 10环境下利用debootstrap工具创建arm64架构的根文件系统。内容包括环境准备、解决qemu的bug、创建根文件系统、chroot进入并定制系统(如换源、设置root密码、配置时区等)、退出chroot、备份根文件系统以及最后制作ext4镜像文件的过程。
摘要由CSDN通过智能技术生成

debootstrap制作arm64根文件系统

参考文档

https://juejin.cn/post/6844903937464598535

环境

Debian 10

软件安装:

sudo apt install debootstrap qemu qemu-user-static binfmt-support

注:Debian 10中的qemu有bug,可能导致后续chroot操作失败。解决方法为编译安装新版qemu及相应user-static镜像,测试使用qemu-5.2.0运行正常。

创建根文件系统

sudo debootstrap --arch=arm64 --foreign bullseye /home/workspace/rootfs https://mirrors.tuna.tsinghua.edu.cn/debian

注:bullseye为Debian系统版本,可根据需要修改。

通过chroot进入制作好的文件系统

chroot脚本ch-mount.sh内容如下:

#!/bin/bash

function mnt() {
   
    echo "MOUNTING"
    sudo mount -t proc /proc ${2}proc
    sudo mount -t sysfs /sys ${2}sys
    sudo mount -o bind /dev ${2}dev
    sudo mount -o bind /dev/pts ${2}dev/pts		
    sudo chroot ${2}
}

function umnt<
  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值