Alpine Linux Porting (一点八?)

开头先上图(?)

[    0.907920] Run /sbin/init as init process
can't run '/etc/init.d/rcS': No such file or directory

Please press Enter to activate this console. 
/ # mount -t proc proc /proc
/ # mount /disk_new.ext2 /sysroo[   19.644547] random: fast init done
t
[   20.796722] EXT4-fs (loop0): mounting ext2 file system using the ext4 subsystem
[   20.802820] EXT4-fs (loop0): mounted filesystem without journal. Opts: (null)
/ # cd sysroot
/sysroot # pivot_root . .
/ # /sbin/apk --version
apk-tools 2.12.7, compiled for riscv32.
/ # /sbin/openrc --help
Usage: openrc [options] [<runlevel>]

Options: [ a:no:s:SChqVv ]
  -n, --no-stop                     do not stop any services
  -o, --override <arg>              override the next runlevel to change into
                                    when leaving single user or boot runlevels
  -s, --service <arg>               runs the service specified with the rest
                                    of the arguments
  -S, --sys                         output the RC system type, if any
  -h, --help                        Display this help output
  -C, --nocolor                     Disable color output
  -V, --version                     Display software version
  -v, --verbose                     Run verbosely
  -q, --quiet                       Run quietly (repeat to suppress errors)
/ # /bin/busybox cat /etc/alpine-release 
3.15.0_alpha20210804
/ # /bin/busybox cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.15.0_alpha20210804
PRETTY_NAME="Alpine Linux edge"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
/ # /bin/busybox cat /etc/motd 
Welcome to Alpine!

The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.

You can setup the system with the command: setup-alpine

You may change this message by editing /etc/motd.

重新打造一次基本上算突破困境了。但接下来迎接的挑战是,如何徒手锻造出符合Alpine正常开机流程的方式。
目前最直觉的方式,依旧是去查看ARMv7那边的路:

$ qemu-system-arm  -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts  \
-append "console=ttyAMA0 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main/" \
-nographic

简单而言,Alpine在volatile的开机流程时,会主动透过去fetch bootarg给的alpine_repo,来组出他真正的环境。但是这个对於我们现在在QEMU以及未来OrangeCrab的VexRiscv上,都还太远了。
最暴力的方式是,先直接把apks塞进去cpio当中:

docker cp <imagehash>:/path/to/local/repo/main ./initramfs_extracted
pushd ./initramfs_extracted
find . | cpio -o -Hnewc |gzip -9 > ../image.cpio.gz
popd
qemu-system-riscv32 -M virt -bios /path/to/opensbi/fw_jump.elf -kernel /path/to/kernel/Image -initrd ./image.cpio.gz -append "debug_init ip=dhcp alpine_repo=/main"

但是目前这样作,我遇到了Alpine Init的mdev在polling有哪些tty时发生无穷回圈

nlplug-findfs: [71] reaped (0 running): /sbin/mdev: ACTION=add DEVPATH=/devices/virtual/tty/ptyc8 SUBSYSTEM=tty SYNTH_UUID=0 MAJOR=2 MINOR=216 DEVNAME=ptyc8 SEQNUM=1101
nlplug-findfs: [72] spawned (1 running): /sbin/mdev: ACTION=add DEVPATH=/devices/virtual/tty/ttyt8 SUBSYSTEM=tty SYNTH_UUID=0 MAJOR=3 MINOR=72 DEVNAME=ttyt8 SEQNUM=1102
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyp1' devpath='/devices/virtual/tty/ttyp1'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyvf' devpath='/devices/virtual/tty/ttyvf'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyx6' devpath='/devices/virtual/tty/ptyx6'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='tty3' devpath='/devices/virtual/tty/tty3'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyxd' devpath='/devices/virtual/tty/ptyxd'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyy6' devpath='/devices/virtual/tty/ttyy6'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyyd' devpath='/devices/virtual/tty/ttyyd'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyt8' devpath='/devices/virtual/tty/ptyt8'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='hvc1' devpath='/devices/virtual/tty/hvc1'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptytf' devpath='/devices/virtual/tty/ptyt

尚待後续来看要怎麽跳过相关的流程。


<<:  Day 14 - useContext

>>:  【Day14】浅谈系统入侵System Hacking(一)

JS AJAX基础实作(3) DAY28

今天要来做gotop按钮啦 我们先来看一下程序码 function gotoTop() { if (...

Day4 被动情蒐(1)-DNS、nslookup、host

被动情蒐目的:了解目标 针对渗透目标,收集公开来源的情报,了解目标的情形,这些资料可能来自受测企业...

他可以坚持,或许我也可以

最近对於自己的未来产生了另一个茫然。 自己会什麽,能给别人什麽,别人又怎麽样会觉得那很棒。 每当遇到...

前端工程学习日记第15天

#网页排版技巧 Part II使用 ul li 设计产品列表 我的作业pencode ...

不只懂 Vue 语法:试解释 computed、watch 与 methods 的差异?

问题回答 简短答法:computed 最大特点是必须回传一个值,并且会把它缓存起来,当函式里的依赖改...