After a few days experience of the gentoo livedvd run from usb, I think the usb drive should be saved for some other important data; I decided to copy the iso and run it from hard disk; usually a hard disk has large enough space, people could just copy all files inside /image.squashfs to a local partition, like the way on gentoo-wiki, but this computer assigned to me has a SSD drive default, has only 120G, furthermore, it's already partitioned long time ago, I don't have more space to back up all data on it and don't want to risk re-partition it; so I'd still like the way of loop mount iso on the fly, for saving disk space;
http://www.gentoo-wiki.info/HOWTO_Lightning_fast_install_from_LiveCD
/dev/sda3 240277504 250068991 4895744 83 Linux /dev/sda5 129341440 132855807 1757184 82 Linux swap / Solaris /dev/sda6 132857856 152387583 9764864 83 Linux LABEL=UBUNTU /dev/sda7 152389632 210980863 29295616 83 Linux LABEL=HOME /dev/sda8 210982912 211372031 194560 83 Linux LABEL=DEBIAN
The ubuntu partition already has grub2 default installed and home partition has a lot of remaining space, so I mkdir /gentoo under /home, put livedvd-amd64-multilib-11.2.iso there, rename or hardlink a short name gentoo.iso there; extract kernel/initramfs from the iso and put into /boot of the ubuntu partition, create a new entry there and no need to install another grub;
Notice that grub2 (version 1.9*) has slightly different syntax with grub1 (version 0.9*):
- disk partition order, counter from 1, same as Linux partitions;
- better not to change (append entries) in grub.cfg directly, use /boot/grub/custom.cfg instead; because every time later ubuntu upgrade or install new kernels would call update-grub2 that would overwrite grub.cfg; you could change /etc/grub/40_custom (that support script smart calculation) or /boot/grub/custom.cfg on that ubuntu partition; here I use custom.cfg;
Gentoo-11 ~ # cat /mnt/sda6/boot/grub/custom.cfg menuentry "Gentoo11-Live Linux-3.0.0 (on /dev/sda7 {gentoo/gentoo.iso})" { linux (hd0,6)/boot/gentoo/gentoo aufs_mem=2G cdroot=/dev/sda7 cdroot_type=ext4 isoboot=gentoo/gentoo.iso vga=791 splash=silent,theme:livecd-10 console=tty1 quiet nodetect doload=ahci dox initrd (hd0,7)/gentoo/gentoo-initramfs.gz }
Compared to previous menuentry in syslinux.cfg, here I removed some unused parameters (like "root=/dev/ram0 init=/linuxrc" because that is the default, I think I should recommend the Gentoo-Ten team to remove that, but not sure if any other computer need it, at least my computer doesn't need it, it could boot, as granted; the only useful parameters here are:
the initramfs is just cpio (newc format) + gz; extract and reconstruct in this way;
- aufs_mem=2G, it means how large of tmpfs layered on top of squashfs by aufs; default it's 420M tmpfs, enough if you don't modify/install too many applications in live mode;
- cdroot=/dev/sda7, specify a parameter saves parsing during booting; specify cdroot_type the same way;
- isoboot=gentoo/gentoo.iso, you need to specify where do you save that iso inside that partition; it's required;
- nodetect doload=ahci dox; depends on if you know your hardware, if no idea, autodetect is best, but I know my hardware, specifying it could save booting time;
the initramfs is just cpio (newc format) + gz; extract and reconstruct in this way;
$ mkdir -vp gentoo-initramfs $ zcat gentoo.igz |(cd gentoo-initramfs; cpio -d -i) $ emacs -nw gentoo-initramfs/...; modify /init and /etc/init.scripts $ (cd gentoo-initramfs/; find |cpio -H newc -o) |gzip -v9 >gentoo-initramfs.gzOr
$ (cd gentoo-initramfs/; find |cpio -H newc -o) |xz -v9 >gentoo-initramfs.xz Gentoo-11 ~ # (cd /home/gentoo/; ls -lh gentoo-initramfs.*) -rw-r--r-- 1 root root 9.8M Aug 16 02:25 gentoo-initramfs.gz -rw-r--r-- 1 root root 7.5M Aug 15 17:50 gentoo-initramfs.xz
The latest xz (aka. lzma2) could save 20% over "gzip -v9";
Update: use "xz --check=crc32" instead, because some latest xz support "none,crc32,crc64,sha256" or more types of integrity check, default as crc64; the kernel xz dec is "xz embedded" that only support "none or crc32", kernel may report XZ_OPTIONS_ERROR, you could use "xz -vl ..." to check it, read Documentation/xz.txt for more;
Update: use "xz --check=crc32" instead, because some latest xz support "none,crc32,crc64,sha256" or more types of integrity check, default as crc64; the kernel xz dec is "xz embedded" that only support "none or crc32", kernel may report XZ_OPTIONS_ERROR, you could use "xz -vl ..." to check it, read Documentation/xz.txt for more;
/usr/src/linux-3.0-gentoo-r1/lib/decompress_unxz.c: -=--:%%--F1 decompress_unxz.c 92% L364 (C/l Abbrev) case XZ_OPTIONS_ERROR: error("Input was encoded with settings that are not " "supported by this XZ decoder"); break; # (cd gentoo-initramfs/; find |cpio -H newc -o) |xz --check=crc32 -v9 >../gentoo-initramfs.xz
No comments:
Post a Comment