lowRISC / lowRISC/lowrisc-chip

switch_root to real rootfs

Open
#147 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
601
Forks
147
PR merge metrics
No merged PRs in 30d

Description

I use `buildroot of ariane-sdk` build image,
and i want to mount `rootfs.tar.xz of lowrsic` as real rootfs.
i modify init script of initramfs:
![init_script](https://user-images.githubusercontent.com/37597992/70027640-90d42780-15dd-11ea-90f9-f0bb64063cf2.png)
it will switch to real rootfs by `switch_root`.

During the linux boot process on Ariane:
`[ 27.512532] mmcblk0: mmc0:0000 SS04G 3.69 GiB`
`[ 28.270961] mmcblk0: p1 p2`
`Mounting SD root`
`[ 34.961062] random: fast init done`
`[ 39.051177] EXT4-fs (mmcblk0p2): recovery complete`
`[ 39.691713] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)`
`Mounting proc`
`Mounting sysfs`
`Mounting devtmpfs`
`Mounting devpts`
`Mounting tmpfs`
`Executing switch_root for mmc`
`INIT: version 2.93 booting`
`[ 93.129442] random: crng init done`
`[ 93.129442] random: crng init done`
`[info] Using makefile-style concurrent boot in runlevel S.`
`[info] Setting the system clock.`
`hwclock: Cannot access the Hardware Clock via any known method.`
`hwclock: Use the --verbose option to see the details of our search for an access method.`
`[warn] Unable to set System Clock to: Thu Jan 1 00:02:56 UTC 1970 ... (warning).`
`[ ok ] Activating swap...done.`
`[ 197.397739] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)`
`[ 197.397739] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)`
`[warn] Creating compatibility symlink from /etc/mtab to /proc/mounts. ... (warning).`
`[....] Checking file systems...fsck from util-linux 2.33.1`
`done.`
`[ ok ] Cleaning up temporary files... /tmp.`
`[ ok ] Mounting local filesystems...done.`
`[ ok ] Activating swapfile swap...done.`
`[ ok ] Cleaning up temporary files....`
`[ ok ] Starting Setting kernel variables: sysctl.`
`[....] Configuring network interfaces...Internet Systems Consortium DHCP Client 4.4.1`
`Copyright 2004-2018 Internet Systems Consortium.`
`All rights reserved.`
`For info, please visit https://www.isc.org/software/dhcp/`

`[ 430.874833] Open device, request interrupt 3`
`[ 430.874833] Open device, request interrupt 3`
`Listening on LPF/eth0/23:01:00:89:07:02`
`Sending on LPF/eth0/23:01:00:89:07:02`
`Sending on Socket/fallback`
`Created duid "\000\001\000\001\307\222\276/#\001\000\211\007\002".`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8`
`DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 2`
`No DHCPOFFERS received.`
`No working leases in persistent database - sleeping.`
`done.`
`[ ok ] Starting RPC port mapper daemon: rpcbind.`
`[ ok ] Starting NFS common utilities: statd idmapd.`
`[ ok ] Cleaning up temporary files....`
`INIT: Entering runlevel: 2`

It will stuck at `sbin/int` process,
sometime at `INIT: Entering runlevel: 2`,
or sometime at `[ ok ] Activating swapfile swap...done.`
I don't know why.

If I change `switch_root /mnt /sbin/int` to `chroot /mnt`,
during the linux boot process on Ariane:
`Executing chroot for mmc`
`bash: cannot set terminal process group (-1): Inappropriate ioctl for device`
`bash: no job control in this shell`
`[ 89.290585] random: crng init done`
`[ 89.290585] random: crng init done`
`root@ariane-fpga:/#`

It looks successful, except `bash: cannot set terminal process group (-1): Inappropriate ioctl for device`
But I still want to use `switch_root`,
because it will delete all content of old rootfs(initramfs).

Can you help me?
Thanks You.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the modified init script shown in the issue and compare the switch_root and chroot entry points, using the boot log to locate where startup stops. Done means explaining why switch_root stalls intermittently and establishing a reliable boot transition that removes the initramfs.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.