switch_root to real rootfs
monrick0303 opened this issue · 10 comments
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:
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.
Thanks you.
So I can use the so-called rescue Linux image run on ariane of pulp-platform rather than ariane of lowrisc ?
Thanks You.
I have posted on ariane-sdk#28
After that.
Since it stuck at /sbin/int of lowrisc real rootfs
, so i am asking on here.
In general,
I want to use lowrisc rootfs
run on ariane of pulp-platform
.
(because it have more command.)
I will test more.
Thanks You.
These Ariane versions are largely the same apart from cache sizes. If you build with the pulp-platform you will get a different set of peripherals, but you can adjust the startup scripts to suit. However I am a little confused, why you are asking on the lowrisc-chip issues github, if your intended use is the pulp-platform ? On the whole it is a bad idea to mix and match unless you want to take responsibility for re-testing everything you use.
…
On 03/12/2019 09:11, monrick0303 wrote: Thanks you. So I can use the so-called rescue Linux image run on ariane of pulp-platform https://github.com/pulp-platform/ariane rather than ariane of lowrisc https://github.com/lowRISC/lowrisc-chip/tree/ariane-v0.7 ? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#147?email_source=notifications&email_token=AAEALV33RFGVXAD6NVWIIUTQWYPEJA5CNFSM4JUTHKF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFYUJTQ#issuecomment-561071310>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEALV3FO2JJC3T2LMEISVTQWYPEJANCNFSM4JUTHKFQ.
Hello,
a different set of peripherals
is mean device tree?
where i can adjust the startup scripts?
lowrisc-chip-ariane-v0.7/linux-5.3.8-lowrisc/arch/riscv/boot/dts
or /lowrisc-chip-ariane-v0.7/fpga/src/generic.dts
?
Thanks your help.
If you want to add or remove peripherals you need to make changes in at least three places:
1. In the Verilog that gets compiled by the Vivado tool
2. In the Linux Kernel to make provision for a suitable device driver
3. In the device tree to specify the address of the device and the driver to be used
4. Optionally, adding packages to the debian installation script to use the new device
If you only want to remove or disable a peripheral, it is sufficient to remove it from fpga/src/generic.dts
and update the bitstream with one of the relatively fast *_new targets, it will not get loaded in Linux, and any attempt to use it will fail. If you don't want to rebuild the bitstream, it might be easier to just disable the device in linux-5.3.8-lowrisc/arch/riscv/configs/defconfig (search for entries that begin with CONFIG_LOWRISC_*), and rebuild Linux. The device tree inside linux-5.3.8-lowrisc/arch/riscv/boot/dts is not used. These files are quite distinct from the startup scripts, which themselves differ from lowrisc release v0.6 to v0.7 because of the change to systemd. Under systemd the method of enabling and disabling is similar to your workstation. You can see an example in debian-riscv64/work/makefile.inc:
sudo chroot work/debian-riscv64-chroot systemctl mask man-db.service
If you are having problems with unwanted startup services you can add extra mask commands in this makefile.inc and rerun the installation of the sd-card.
So,if i don't want to rebuild the bitsteam,i just
1.disable the device in linux-5.3.8-lowrisc/arch/riscv/configs/defconfig (search for entries that begin with CONFIG_LOWRISC_*), and rebuild Linux.
2.make bbl
3.install the sd-card by lowrisc-quickstart
(The no.3 step can use GPT partition table of ariane-sdk ?)
Now i can boot linux-5.3.8-lowrisc with bitstream of pulp-platform.
But it will mount -t ext4 /dev/mmcblk0p2 /mnt failed
.
it might can't read second partition of sd-card.
Thanks your help!
I haven't tried the pulp-platform bitstream recently. Last time I tried it it used the Xilinx SPI driver for the SD-Card. It works only in one-bit mode, but is supported by Linux. You will need to use a matching device tree blob and kernel. It will not work with the unmodified LowRISC config. You could prepare a kernel config which is a superset of what LowRISC and pulp-platform will require, but I don't understand the motivation for this. Another difference is the partition table, LowRISC uses a DOS partition to store the kernel, pulp-platform stores it in a boot partition. If you can explain why the lowrisc bitstream doesn't suit your purpose, I could be more helpful.
Hello,
I can boot linux and mount rootfs after modify linux config.
but i have some problem.
following is boot process:
[ 16.602667] mmcblk0: mmc0:0000 SS04G 3.69 GiB
[ 16.823504] Freeing unused kernel memory: 2524K
[ 16.833640] This architecture does not have kernel memory protection.
[ 16.852885] Run /init as init process
[ 18.584001] mmcblk0: p1 p2
Mounting SD root
[ 24.511067] random: fast init done
[ 72.367935] EXT4-fs (mmcblk0p2): recovery complete
[ 72.468043] 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
[ 85.132918] random: crng init done
INIT: version 2.93 booting
[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:03:22 UTC 1970 ... (warning).
[ ok ] Activating swap...done.
[ 220.914645] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 220.914645] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[....] 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/
Cannot find device "eth0"
Failed to get interface index: No such device
If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging.
exiting.
ifup: failed to bring up eth0
failed.
[ ok ] Starting RPC port mapper daemon: rpcbind.
[FAIL] Starting NFS common utilities: statd idmapd failed!
[ ok ] Cleaning up temporary files....
[FAIL] startpar: service(s) returned failure: nfs-common ... failed!
INIT: Entering runlevel: 3
[info] Using makefile-style concurrent boot in runlevel 3.
[ ok ] Starting NTP server: ntpd.
Recovering nvi editor sessions.
none found.
[ ok ] Starting OpenBSD Secure Shell server: sshd.
bash: cannot set terminal process group (959): Inappropriate ioctl for device
bash: no job control in this shell
root@lowrisc:/#
1.why there occur fail?
[FAIL] Starting NFS common utilities: statd idmapd failed!
[FAIL] startpar: service(s) returned failure: nfs-common ... failed!
2.
bash: cannot set terminal process group (959): Inappropriate ioctl for device
bash: no job control in this shell
this is normal status?
3.I can't use ssh.
I use command ifconfig -a
, there have't eth0
.
it only have lo
and sit0
.
And my reason is my team design a ip for ariane of pulp-platform.
So we hope use lowrisc-rootfs, but still use pulp-platform bitstream.
Thanks for your help.
You probably managed to disable the Ethernet device driver amongst the various edits you have done. Needless to say if Ethernet is disabled, NFS and ssh will not work. Your best option right now would be to get the unmodified LowRISC design up and running on your board, and then compare the boot logs between my working version and your version. For example I would expect to see a message such as this:
[ 3.007706] lowrisc-digilent-ethernet: Lowrisc ethernet platform (43000000-43007FFF) mapped to ffffffd004030000
early on during booting. If you don't get this either your device tree blob or kernel config (or Verilog) is wrong (the address may be different in pulp platform). You will appreciate it can be useful to combine outputs from different research groups in different countries, but it might not be the best starting point if you want to get something working quickly. Notwithstanding this, if you want to port your IP to the version of Ariane in lowRISC, I shall be happy to assist.
Right now I see a problem, you have made modifications to an unsupported configuration, and you don't have a reference baseline to compare against, and you are asking for advice whilst failing to provide adequate information to justify the deviation from the expected path of development. It's unlikely any other potential users can benefit from this discussion, except as an example of how not to do it.
This puts me in a difficult position, presuming to advice about a system of your own devising which I know next to nothing about. If I give you a bum steer, should I take the blame if your project fails? The best I can hope for is that at some point you will become sufficiently experienced to be able to cut your own swath.