For faster development cycles, I prefer netbooting an NFS-mounted root
filesystem instead of booting flash or ISO images.
After some fiddling, I got this to work with android-x86 on an Atom
panel PC. Thus, I can immediately boot the target from the build
directory on the host w/o the need to write any CD/USB media.
Basically, I booted via PXE (which is available in most x86 systems'
BIOSes today) and NFS into the installer/ root so that things go the
same way as during a CD boot.
This required a minimal patch to bootable/newinstaller/initrd/init which
you can find attached. If someone wants to test it, please replace the
nfsroot=... parameter reflecting your setup.
So... What do you think about integrating this feature into mainline?
Certainly, the hard-coded NFS path in the attached patch is not for
mainline integration. But before polishing this (I thought
about shell code to extract the actual NFS root from /proc/cmdline),
I wanted to hear your general opinion.
A short howto will follow for experienced early adopters ;) - if you
plan for mainline integration, I can surely provide a more detailed
howto for your homepage.
--------
Set up a TFTP, DHCP and NFS server on the host. The NFS server exports
out/target/product/generic_x86/installer/ from the android-x86 build
directory.
For PXE, I provided pxelinux.0 from the OpenSUSE syslinux package to the
TFTP root (usually /srv/tftpboot). Create <TFTProot>/pxelinux.cfg/default,
holding the boot config:
------ SNIP -----
prompt 1
timeout 50
default android
label android
kernel kernel
append ip=dhcp root=/dev/nfs rw nfsroot=192.168.0.100:/path/to/android-x86/out/target/product/generic_x86/installer/ console=ttyS4,115200 DEBUG=1 initrd=initrd.img
------ SNIP -----
The "append" line can be extended using parameters from out/target/
product/generic_x86/boot/isolinux/isolinux.cfg.
Don't forget to replace the nfsroot path with your actual NFS export.
The console=... setting needs to be adapted to your serial port
settings or removed if you want to use the local console.
--
With kind regards,
Gernot Hillier
Siemens AG, CT T, Program "Open Source Platforms"
Am 17.04.2012 13:07, schrieb fuzzy7k:
> I like the idea. I had set up something similar a while back but there
> was not much interest in it. I think mainly because nfs support was not
> built into busybox, nor was there interest in adding it.
It worked without any busybox modifications. There are only two caveats:
- I needed to mount with "-o nolock" to avoid necessity of portmap,
lockd and friends.
- I needed to add a small workaround to the installer shell function
remount_rw (just use an arbitrary mount source, it's ignored anyways)
as Busybox seems to stumble while parsing nfs-specific mount options
when the mount source isn't mentioned explicitely.
Including those workarounds, it was really only about changing three
lines of source code.
> The way it was explained to me is you could netboot it by
> transferring the entire iso as the ramdisk. I never did try it that
> way.
Yeah, I also found that when starting my work - however, I wanted to
speed things up - and doing a full TFTP ISO download on each reboot
didn't seem the right way to me. (Not mentioning, that I don't have to
wait for mkisofs to finish before I can boot up my target after a change.)
And, booting without ISO could also help speeding up development cycles
for emulator boot, as a colleague recently mentioned. However, I didn't
try this yet.
> One suggestion, there is no need to parse /proc/cmdline. Just use your
> variable, $nfsroot.
Ah, great, thanks. Didn't think of that... :)
--
Sorry for reply late.
I think the -o nolock and remount_rw changes are OK.
However, hardcoded the nfsroot in the script seems not good.
+ for device in ${ROOT:-/dev/sr* /dev/[hs]d[a-z]*
192.168.0.100:/media/gernot-projects/android-x86/out/target/product/generic_x86/};
do
Could you just set ROOT=192.168.0.100...
in your cmdline? It should work. Shouldn't it?
>> The way it was explained to me is you could netboot it by
>> transferring the entire iso as the ramdisk. I never did try it that
>> way.
>
>
> Yeah, I also found that when starting my work - however, I wanted to speed
> things up - and doing a full TFTP ISO download on each reboot didn't seem
> the right way to me. (Not mentioning, that I don't have to wait for mkisofs
> to finish before I can boot up my target after a change.)
>
> And, booting without ISO could also help speeding up development cycles for
> emulator boot, as a colleague recently mentioned. However, I didn't try this
> yet.
>
>
>> One suggestion, there is no need to parse /proc/cmdline. Just use your
>> variable, $nfsroot.
>
>
> Ah, great, thanks. Didn't think of that... :)
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Will the contents of the default .iso file work with pxe? Does the kernel have to be reconfigured/recompiled to enable nfs mounting?
Hi,
I didn't test the NFS mounting feature myself.
If you think we missed some kernel config to support it,
send me a patch.
Thank you!
> --
> You received this message because you are subscribed to the Google Groups "Android-x86" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.
> To post to this group, send email to andro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/android-x86.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Android-x86" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-x86/SdaOXm1Mt0g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-x86...@googlegroups.com.
2015/2/12 下午1:50 於 "Pccom Frank" <pccom...@gmail.com> 寫道:
>
> I am still detecting android_x86 ................. forever.
>
>
> What I did:
>
> I re-compiled kernel with NFS 4.1 support. Then,
>
> In the debug mode(busybox shell), I did following:
>
> modprobe e1000
> modprobe sunrpc
> modprobe lockd
> modprobe nfs
>
>
> ifconfig eth0 192.168.0.111 netmask 255.255.255.0
> route add default gw 192.168.0.1
> mkdir /mnt/nfs
> /system/xbin/mount -t nfs -o nolock 192.168.0.1:/opt/nfs/android-2015-02-08 /mnt/nfs
>
> It worked.
>
> But I do know how to switch_root to /mnt/nfs. I have no way to enter the /sbin/init program to start OS.
You meant you do NOT know? Why?
Switching root to nfs is nothing different than switching to others.
Depends on how many stuff you hope to put on nfs,
there are two approaches (at least):
* All stuff are on nfs including the first init process
In this case you need the nfsroot support.
You need deeper knowledge about linux and android booting.
More difficult but still doable.
* You can load initrd.img locally so you already have the basic
filesystem, then try to mount nfs and switch to it.
From your description I think you tried the second approach.
This should already be supported by the ROOT variable of initrd.img.
Just specify this in cmdline:
ROOT=192.168.0.1:/opt/nfs/android-2015-02-08
You just need to make sure the nfs contains the
ramdisk.img and system.sfs (or system.img).
> Then I go back to the kernel, I found all modules above are m.
That's an issue.
The simplest solution is just change them to y.
Or you need to put them into initrd.img
and write script to load them.
> The second question is that all the modules needed by nfs are loaded in the kernel or not? The load_modules function worked or not? I do not know.
>
> This is the init program
> ......
> # load scripts
> for s in `ls /scripts/* /src/scripts/*`; do
> test -e "$s" && source $s
> done
This allows you to hook customized scripts
without rebuilding the initrd.img.
But it may not be helpful to your problem...
> # A target should provide its detect_hardware function.
> # On success, return 0 with the following values set.
> # return 1 if it wants to use auto_detect
> ......
>
> Third question is that "Do we have a script for nfs detecting?"
What do you want to detect exactly?
If you want a script to load necessary modules, apparently no.
> After all of these success, it will go to the /sbin/init program, which is using the init.rc configuration file.
>
> I saw in the scripts/0-auto-detect program, it is shooting the init.rc file.
> After nfsroot every success, if we cannot write init.rc right, still it will not work:
> Third question is, is that possible that the NFS filesystem worked, but it won't pass to operating system, that means the binary file /sbin/init won't work with the configuration file: init.rc.
These functions are considered deprecated and may be removed in the future.
The current android-x86 implementation doesn't rely on them at all.
So you don't need to bother with them.