一键生成可定制的Debian rootfs,支持riscv64
-
论坛之前已经有一个使用debootstrap生成Debian rootfs的教程了,但我一直使用的是一个Github上的自动生成脚本来生成,优势主要是:
更方便,跑一个脚本生成直接可用的rootfs,无需更多设置
包括版本和预装包都完全可定制
生成的rootfs可以直接chroot进去,所需的依赖自动安装
最近给D1s定制rootfs,为了支持riscv64,我对原作者的脚本进行了一定的魔改,在此分享一下使用方法:
首先clone仓库到本地:
git clone https://github.com/SdtElectronics/debian-rootfs.git
然后安装相关依赖
apt-get install multistrap binfmt-support qemu-user-static
最后运行一条命令即可生成:
./make-rootfs.sh ARCHITECTURE
支持的ARCHITECTURE有:amd64 arm64 armel armhf i386 mips mipsel powerpc powerpcspe ppc64el s390x riscv64
注意要是想生成riscv64的rootfs,需要改用如下命令(因为risc-v目前还在Debian port源下):
sudo ./make-rootfs.sh riscv64 multistrap_debian-ports.conf
生成的rootfs在build/目录下。
若脚本运行时出现类似错误信息:The following signatures couldn't be verified because the public key is not available
需要手动给 /usr/sbin/multistrap 的文件打上这个补丁。
更多信息,可以参考原仓库:
https://github.com/SdtElectronics/debian-rootfs
一些进阶用法:
更改预装包:
修改multistrap.conf中的packages字段即可。注意要生成riscv64的rootfs,需要修改的是multistrap_debian-ports.conf。
更改版本:
修改multistrap.conf中的suite字段即可。合法的值可以是版本名,或者是stable, testing和sid。注意要生成riscv64的rootfs,需要修改的是multistrap_debian-ports.conf。
异构chroot:
异构chroot所需的qemu等依赖,脚本都已经自动装好,直接chroot ./ 即可。
原作者: @SdtEE
链接:
一键生成可定制的Debian rootfs,支持riscv64
https://whycan.com/t_7367.html -
嗯,感谢楼主分享,我的哪吒就是这么做debian rootfs 的。
-
@memory 在 一键生成可定制的Debian rootfs,支持riscv64 中说:
么做debian roo
请问有人用了这个工具了吗?做出来无法启动呢,出现错误信息如下:
[ 4.469869] I2C communication ERROR!
[ 4.469901] regulator-dummy: Underflow of regulator enable count
[ 4.480911] gt9xxnew_ts: probe of 1-0014 failed with error -1
[ 4.490050] OF: fdt: not creating '/sys/firmware/fdt': CRC check failed
[ 4.497539] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 4.508814] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 4.516332] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 4.526089] clk: Not disabling unused clocks
[ 4.530919] ALSA device list:
[ 4.534249] #0: audiocodec
[ 4.537490] alloc_fd: slot 0 not NULL!
[ 4.541767] cfg80211: failed to load regulatory.db
[ 4.558945] EXT4-fs (mmcblk0p5): recovery complete
[ 4.564396] EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: (null)
[ 4.573566] VFS: Mounted root (ext4 filesystem) on device 179:5.
[ 4.581999] Freeing unused kernel memory: 1024K
[ 4.600127] Kernel init done
[ 4.603355] Run /sbin/init as init process
[ 4.704682] Kernel panic - not syncing: Requested init /sbin/init failed (error -2).
[ 4.713373] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.61 #2
[ 4.720003] Hardware name: Generic DT based system
[ 4.725394] [<c010e308>] (unwind_backtrace) from [<c010a8ac>] (show_stack+0x10/0x14)
[ 4.734078] [<c010a8ac>] (show_stack) from [<c089698c>] (dump_stack+0x7c/0x98)
[ 4.742177] [<c089698c>] (dump_stack) from [<c011a014>] (panic+0x104/0x3dc)
[ 4.749986] [<c011a014>] (panic) from [<c08ab694>] (kernel_init+0x98/0x118)
[ 4.757792] [<c08ab694>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[ 4.766274] Exception stack(0xde43dfb0 to 0xde43dff8)
[ 4.771934] dfa0: 00000000 00000000 00000000 00000000
[ 4.781099] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 4.790264] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 4.797689] CPU1: stopping
[ 4.800722] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.4.61 #2
[ 4.807352] Hardware name: Generic DT based system
[ 4.812725] [<c010e308>] (unwind_backtrace) from [<c010a8ac>] (show_stack+0x10/0x14)
[ 4.821406] [<c010a8ac>] (show_stack) from [<c089698c>] (dump_stack+0x7c/0x98)
[ 4.829504] [<c089698c>] (dump_stack) from [<c010c6b0>] (handle_IPI+0xc0/0x168)
[ 4.837701] [<c010c6b0>] (handle_IPI) from [<c0431a80>] (gic_handle_irq+0x70/0x78)
[ 4.846189] [<c0431a80>] (gic_handle_irq) from [<c01021cc>] (__irq_svc+0x6c/0xa8)
[ 4.854572] Exception stack(0xde477f80 to 0xde477fc8)
[ 4.860233] 7f80: 00000b68 deb416b4 00000000 c01153a0 00000002 de476000 c0e03e28 c0e03e68
[ 4.869400] 7fa0: 4000406a 410fc075 00000000 00000000 00000000 de477fd0 c0107fb8 c0107fbc
[ 4.878563] 7fc0: 60000113 ffffffff
[ 4.882476] [<c01021cc>] (__irq_svc) from [<c0107fbc>] (arch_cpu_idle+0x2c/0x38)
[ 4.890770] [<c0107fbc>] (arch_cpu_idle) from [<c013fae8>] (do_idle+0xb8/0x120)
[ 4.898965] [<c013fae8>] (do_idle) from [<c013fdec>] (cpu_startup_entry+0x18/0x1c)
[ 4.907452] [<c013fdec>] (cpu_startup_entry) from [<40102c0c>] (0x40102c0c)
[ 4.915269] ---[ end Kernel panic - not syncing: Requested init /sbin/init failed (error -2). ]---
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号