Differences

This shows you the differences between the selected revision and the current version of the page.

howto:chroot_gentoo 2015/07/28 22:32 howto:chroot_gentoo 2017/09/06 17:55 current
Line 1: Line 1:
-Attractive section of cennott. I just stumbled upon your blog and in accession capital to assert that I get actually enjoyed account your blog posts. Anyway I will be subscribing to your feeds and even I achievement you access consistently rapidly. http://pgrbqnosuew.com [url=http://ygufisvju.com]ygufisvju[/url] [link=http://fcjgqiyjt.com]fcjgqiyjt[/link]+====== How-to chroot into Gentoo ====== 
 + 
 +===== Files needed ===== 
 + 
 +  * [[http://dns323.kood.org/downloads/bzip2-1.0.3.tar.bz2|bzip2]] 
 +  * [[http://dns323.kood.org/downloads/tar-1.15.92.tar.bz2|tar]] 
 +  * [[http://dns323.kood.org/downloads/chroot-5.97.tar.bz2|chroot]] 
 +  * [[http://ftp.eenet.ee/gentoo/experimental/ppc/embedded/stages/stage3-ppc-uclibc-2005.0.tar.bz2|stage3-ppc-uclibc-2005.0]] (recommended for gentoo chroot) or [[http://ftp.eenet.ee/gentoo/experimental/ppc/embedded/stages/stage3-ppc-uclibc-2006.1.tar.bz2|stage3-ppc-uclibc-2006.1]] (recommended for gentoo boot). Don't use 2008.0 stage because it is compiled against 2.6 kernel headers. 
 +  * [[http://ftp.eenet.ee/gentoo/snapshots/portage-latest.tar.bz2|portage tree]] 
 + 
 +===== Installing steps ===== 
 + 
 +  - ''ln -s /mnt/HD_a2/bzip2 /mnt/HD_a2/bzcat'' 
 +  - ''mkdir /mnt/HD_a2/gentoo'' 
 +  - ''cd /mnt/HD_a2/gentoo'' 
 +  - ''/mnt/HD_a2/bzcat /mnt/HD_a2/stage3-ppc-uclibc-2006.1.tar.bz2 | /mnt/HD_a2/tar -xvpf -'' 
 +  - ''cd /mnt/HD_a2/gentoo/usr'' 
 +  - ''/mnt/HD_a2/bzcat /mnt/HD_a2/portage-latest.tar.bz2 | /mnt/HD_a2/tar -xvf -'' 
 +  - ''mount -o bind /dev /mnt/HD_a2/gentoo/dev'' 
 +  - ''mount -t proc none /mnt/HD_a2/gentoo/proc'' 
 +  - ''cp /etc/resolv.conf /mnt/HD_a2/gentoo/etc/'' 
 +  - ''/mnt/HD_a2/chroot /mnt/HD_a2/gentoo /bin/bash'' 
 +  - Update [[howto:chroot_gentoo#etc_make.conf|/etc/make.conf]] 
 +  - Update [[howto:chroot_gentoo#etc_conf.d_net|/etc/conf.d/net]] 
 +  - ''env-update && source /etc/profile'' 
 +  - ''rc-update add net.eth0 default'' 
 +  - ''rc-update add dropbear default'' 
 +  - ''passwd root'' 
 +  - **If you did choose to use 2005.0 stage then you must update e2fsprogs!** ''emerge e2fsprogs'' 
 +  - **If you are going to hddboot, always make sure that devfsd is installed!** ''emerge -pv devfsd'' 
 +  - **It is also recommended that you update sys-apps/baselayout package. Its needed by net configuration to change mac address.** However, by default, baselayout pulls in and builds module-init-tools with support only for 2.6 kernels. So, to allow the updated module-init-tools to be built with support for both 2.4 and 2.6 kernels: ''echo %%"sys-apps/module-init-tools      old-linux" >> %%/etc/portage/package.use'' 
 +  - ''emerge sys-apps/baselayout'' 
 + 
 +==== /etc/make.conf ==== 
 +<code> 
 +CFLAGS="-Os -pipe -mcpu=603e -mtune=603e" 
 +CHOST="powerpc-pc-linux-uclibc" 
 +CXXFLAGS="-Os -pipe -mcpu=603e -mtune=603e" 
 +LDFLAGS="-Wl,-z,relro" 
 +USE="-*" 
 +PORTAGE_RSYNC_EXTRA_OPTS="—exclude-from=/etc/portage/rsync_excludes" 
 +SYNC="rsync://rsync1.ee.gentoo.org/gentoo-portage" 
 +GENTOO_MIRRORS="http://ftp.linux.ee/pub/gentoo/distfiles ftp://ftp.linux.ee/pub/gentoo/distfiles" 
 +</code> 
 + 
 +==== /etc/fstab ==== 
 +<code> 
 +/dev/sda3              /              ext3            noatime                0 0 
 +/dev/sda1              none            swap            sw                      0 0 
 +none                    /proc          proc            defaults                0 0 
 +none                    /dev/shm        tmpfs          defaults                0 0 
 +none                    /dev/pts        devpts          gid=5,mode=620          0 0 
 +</code> 
 + 
 +==== /etc/conf.d/net ==== 
 +net is needed only if you are going to boot gentoo using loader.o or flashed custom kernel. 
 +<code> 
 +config_eth0=( "yourNASip netmask 255.255.255.0 broadcast yourBroadcastAddress" ) 
 +routes_eth0=( "default gw yourGatewayAddress" ) 
 +mac_eth0="yourMACaddress" 
 +dns_servers_eth0=( "yourDNSserverAddress" ) 
 +</code> 
 + 
 +Example : 
 +<code> 
 +config_eth0=( "192.168.0.20 netmask 255.255.255.0 broadcast 192.168.0.255" ) 
 +routes_eth0=( "default gw 192.168.0.254" ) 
 +mac_eth0="00:15:E9:6D:22:11" 
 +dns_servers_eth0=( "212.20.30.40" ) 
 +</code> 
 + 
 +==== /etc/conf.d/wireless ==== 
 +wireless is needed only if you are going to boot gentoo using loader.o or flashed custom kernel.\\ 
 +Get new (1.1.0 BETA4) rt2500.o from [[http://download.dsmg600.info/people/sala/rt2500.o|here]]. For more info look [[http://forum.dsmg600.info/p26074-Today-17%3A03%3A31.html#p26074|here]]. 
 + 
 +<code> 
 +iwpriv_yourssid=
 +        "set AuthMode=WPAPSK" 
 +        "set EncrypType=TKIP" 
 +        "set WPAPSK=your-wpa-psk" 
 +
 +sleep_scan_ra0="5" 
 +essid_ra0="yourssid" 
 +channel_ra0="11" 
 +prefarred_aps=( "yourssid" ) 
 +associate_order_ra0="forceprefarred" 
 +dns_servers_yourssid=( "192.168.1.1" ) 
 +dns_domain_yourssid=( "you-domain" ) 
 +key_yourssid="s:your-wpa-psk enc open" 
 +config_yourssid=( "192.168.1.3/24 brd 192.168.1.255" ) 
 +routes_yourssid=( "default via 192.168.1.1" ) 
 +</code> 
 + 
 +==== /etc/portage/rsync_excludes ==== 
 +<code> 
 +- app-accessibility/ 
 +- metadata/cache/app-accessibility/ 
 +- app-emulation/ 
 +- metadata/cache/app-emulation/ 
 +- app-laptop/ 
 +- metadata/cache/app-laptop/ 
 +- app-office/ 
 +- metadata/cache/app-office/ 
 +- app-pda/ 
 +- metadata/cache/app-pda/ 
 +- dev-games/ 
 +- metadata/cache/dev-games/ 
 +- games-*/ 
 +- metadata/cache/games-*/ 
 +- gnome-*/ 
 +- metadata/cache/gnome-*/ 
 +- kde-*/ 
 +- metadata/cache/kde-*/ 
 +- rox-*/ 
 +- metadata/cache/rox-*/ 
 +- media-tv/ 
 +- metadata/cache/media-tv/ 
 +- media-video/ 
 +- metadata/cache/media-video/ 
 +- sci-*/ 
 +- metadata/cache/sci-*/ 
 +- x11-*/ 
 +- metadata/cache/x11-*/ 
 +- xfce-*/ 
 +- metadata/cache/xfce-*/ 
 +</code> 
 + 
 +==== Cleaning portage ==== 
 +  - ''cd /usr/portage'' 
 +  - ''rm -r `gawk '{ printf("%s ",$2) }' /etc/portage/rsync_excludes`'' 
 + 
 +==== Testing ==== 
 +  - ''USE=unicode emerge links'' 
 + 
 +==== Additional software ==== 
 +  * [[http://dns323.kood.org/forum/t788-ntpclient-gentoo-hdd-boot-chroot.html|NTPclient]] 
 +  * [[http://dns323.kood.org/forum/t955-chkbutton-replacement.html|DSMG600 button and leds]] 
 + 
 +===== chrooting ==== 
 + 
 +If you have exited from chroot environment after installing gentoo chroot or if you have rebooted your DSM-G600 then you need following commands to enter back in chroot environment. 
 +  - ''mount -o bind /dev /mnt/HD_a2/gentoo/dev'' 
 +  - ''mount -t proc none /mnt/HD_a2/gentoo/proc'' 
 +  - ''/mnt/HD_a2/chroot /mnt/HD_a2/gentoo /bin/bash'' 
 + 
 +==== Chrooted DropBear ==== 
 + 
 +will fail by default due to the default kernel not supporting uni98 ptys. 
 + 
 +Correct build: 
 +<code> 
 +EXTRA_ECONF=--disable-openpty emerge dropbear 
 + </code> 
 + 
 +First time installation: 
 +<code> 
 +ln -s /dev/urandom /dev/random 
 +mkdir /etc/dropbear/ 
 +/usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key 
 +/usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key 
 +</code> 
 + 
 +Auto-start from fun_plug (assuming a working busybox): 
 +<code> 
 +ln -s /mnt/HD_a2/bin/busybox /bin/chroot 
 +ln -s /mnt/HD_a2/bin/busybox /bin/makedevs 
 +cd /dev 
 +/bin/makedevs ptyp c 2 0 0 9 
 +/bin/makedevs ttyp c 3 0 0 9 
 +ln -s urandom random 
 + 
 +mount -o bind /dev /mnt/HD_a2/gentoo/dev 
 +mount -t proc none /mnt/HD_a2/gentoo/proc 
 +cp /etc/resolv.conf /mnt/HD_a2/gentoo/etc/ 
 + 
 +/bin/chroot /mnt/HD_a2/gentoo /usr/sbin/dropbear 
 +</code> 
 + 
 +===== Successful Gentoo boot log ===== 
 +<code> 
 +
 + 
 +U-Boot 0.2.0 (May 11 2005 - 18:56:16) 
 + 
 +CPU:  MPC8245 V1.2 at 170.503 MHz: 
 +Board: Sandpoint 8245 
 +DRAM:  32 MB 
 +FLASH: FUJI_DL323BE  
 +In:    serial 
 +Out:  serial 
 +Err:  serial 
 +Hit any key to stop autoboot:  0  
 +=> bootm FFF10000 
 +## Booting image at fff10000 ... 
 +  Image Name:  Linux-2.4.21-pre4 
 +  Image Type:  PowerPC Linux Kernel Image (gzip compressed) 
 +  Data Size:    884424 Bytes = 863.7 kB 
 +  Load Address: 00000000 
 +  Entry Point:  00000000 
 + Verifying Checksum ... OK 
 +  Uncompressing Kernel Image ... OK 
 +Total memory 33554432 MB. 
 +Memory BAT mapping: BAT2=32Mb, BAT3=0Mb, residual: 0Mb 
 +Total memory is 33554432. 
 +CPU = 82xx 
 +Linux version 2.4.21-pre4 (root@serv) (gcc version 2.95.4 20010319 (prerelease)) #480 Mon Feb 19 17:19:05 EET 2007 
 +OpenPIC_Addr in mpc10x_bridge_init function is fc040000  
 +Motorola SPS Sandpoint Test Platform 
 +Port by MontaVista Software, Inc. (source@mvista.com
 +On node 0 totalpages: 8192 
 +zone(0): 8192 pages. 
 +zone(1): 0 pages. 
 +zone(2): 0 pages. 
 +Kernel command line: root=/dev/sda3 console=ttyS0,9600 
 +OpenPIC Version 1.2 (1 CPUs and 123 IRQ sources) at fc040000 
 +Calibrating delay loop... 133.12 BogoMIPS 
 +Memory: 30176k available (1564k kernel code, 584k data, 56k init, 0k highmem) 
 +Dentry cache hash table entries: 4096 (order: 3, 32768 bytes) 
 +Inode cache hash table entries: 2048 (order: 2, 16384 bytes) 
 +Mount cache hash table entries: 512 (order: 0, 4096 bytes) 
 +Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes) 
 +Page-cache hash table entries: 8192 (order: 3, 32768 bytes) 
 +POSIX conformance testing by UNIFIX 
 +PCI: Probing PCI hardware 
 +PCI fixup irq: (PCI device 1814:0201) got 0 
 +PCI fixup irq: (PCI device 1033:0035) got 1 
 +PCI fixup irq: (PCI device 1033:0035) got -1 
 +PCI fixup irq: (PCI device 1033:00e0) got 2 
 +PCI fixup irq: (PCI device 13f0:1023) got 3 
 +PCI fixup irq: (PCI device 1191:0008) got 4 
 +Linux NET4.0 for Linux 2.4 
 +Based upon Swansea University Computer Society NET3.039 
 +Initializing RT netlink socket 
 +Starting kswapd 
 +Journalled Block Device driver loaded 
 +devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au) 
 +devfs: boot_options: 0x1 
 +udf: registering filesystem 
 +pty: 256 Unix98 ptys configured 
 +Serial driver version 5.05c (2001-07-08) with MANY_PORTS SERIAL_PCI enabled 
 +ttyS00 at 0xfc004500 (IOMEM)(irq = 121) is a ST16650 
 +ttyS01 at 0xfc004600 (IOMEM)(irq = 122) is a ST16650 
 +loop: loaded (max 8 devices) 
 +ipg : v0.36 10/31/01  Written by Craig Rich, www.sundanceti.com 
 +IC PLUS IP1000 1000/100/10 based NIC found. 
 +Ethernet device registered as: eth0 
 +IPG module loaded. 
 +SCSI subsystem driver Revision: 1.00 
 +atp86x_detect:  
 +  ACARD ATP-865 PCI ATA133 2-Channels Host Adapter: 0    IO:FEBFFEF8, IRQ:4. 
 +        ID:  0  FUJITSU MHT2060AT                UDMA5 (100) 
 +scsi0 : ACARD ATP86X PCI ATA133 Adapter Driver Ver: 0.78  Date: 2004/01/15 
 + 
 +  Vendor: FUJITSU  Model: MHT2060AT        Rev:     
 +  Type:  Direct-Access                      ANSI SCSI revision: 02 
 +Attached scsi disk sda at scsi0, channel 0, id 0, lun 0 
 +SCSI device sda: 117210239 512-byte hdwr sectors (30006 MB) 
 +Partition check: 
 + p1 p2 p3 p4 
 +USI AMD/FUJITSU flash: probing 8-bit flash bus 
 + Amd/Fujitsu Extended Query Table at 0x0040 
 +number of CFI chips: 1 
 +cfi_cmdset_0002: Disabling fast programming due to code brokenness. 
 +Creating 5 MTD partitions on "USI Intel flash": 
 +0x00000000-0x00010000 : "Linux mtd1" 
 +0x00010000-0x00020000 : "Linux mtd2" 
 +0x00020000-0x00300000 : "Linux Ramdisk" 
 +0x00300000-0x00310000 : "U-BOOT BOOT LOADER" 
 +0x00310000-0x00400000 : "Linux Kernel" 
 +usb.c: registered new driver hub 
 +NET4: Linux TCP/IP 1.0 for NET4.0 
 +IP Protocols: ICMP, UDP, TCP 
 +IP: routing cache hash table of 512 buckets, 4Kbytes 
 +TCP: Hash tables configured (established 2048 bind 2048) 
 +NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. 
 +kjournald starting.  Commit interval 5 seconds 
 +EXT3-fs: mounted filesystem with ordered data mode. 
 +VFS: Mounted root (ext3 filesystem) readonly. 
 +Mounted devfs on /dev 
 +Freeing unused kernel memory: 56k init 
 +INIT: version 2.86 booting 
 + 
 +Gentoo Linux; http://www.gentoo.org/ 
 + Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 
 + 
 + * Mounting proc at /proc ...                                            [ ok ] 
 + * Kernel automatically mounted devfs at /dev ...                        [ ok ] 
 + * Starting devfsd ...Started device management daemon v1.3.25 for /dev 
 +                                                    [ ok ] 
 + * Activating (possible) swap ...Adding Swap: 506480k swap-space (priority -1) 
 +                                        [ ok ] 
 + * Skipping root filesystem check (fstab's passno == 0) ...              [ ok ] 
 + * Remounting root filesystem read/write ...                              [ ok ] 
 + * Setting hostname to dsmg600 ...                                        [ ok ] 
 + * Calculating module dependencies ...                                    [ ok ] 
 + * Checking all filesystems ...                                          [ ok ] 
 + * Mounting local filesystems ...                                        [ ok ] 
 + * Activating (possibly) more swap ...                                    [ ok ] 
 + * Setting system clock to hardware clock [Local Time] ... 
 + * Cannot access the Hardware Clock via any known method. 
 +Use the --debug option to see the details of our search for an access method. 
 +Cannot access the Hardware Clock via any known method. 
 +Use the --debug option to see the details of our search for an access method. 
 + * Failed to set system clock to hardware clock 
 +                                                                          [ !! ] 
 + * Failed to start /etc/init.d/clock 
 + * Setting DNS domainname to penthouse.lan ...                            [ ok ] 
 + * Configuring kernel parameters ...                                      [ ok ] 
 + * Updating environment ...                                              [ ok ] 
 + * Cleaning /var/lock, /var/run ...                                      [ ok ] 
 + * Cleaning /tmp directory ...                                            [ ok ] 
 + * Starting lo 
 + *  Bringing up lo ...                                                  [ ok ] 
 + * Initializing random number generator ...                              [ ok ] 
 +INIT: Entering runlevel: 3 
 + * Starting eth0 
 + *  Bringing up eth0 
 + *    192.168.1.10 
 +                                                                          [ ok ] 
 +                                                                          [ ok ] 
 + *  Adding routes 
 + *    default gw 192.168.1.1 ...                                        [ ok ] 
 + * Starting dropbear ...                                                  [ ok ] 
 + * Mounting network filesystems ...                                      [ ok ] 
 + * Setting clock via the NTP client 'ntpdate' ...                        [ ok ] 
 + * Starting local ...                                                    [ ok ] 
 +INIT: no more processes left in this runlevel</code> 
 + 
 +===== Troubleshooting ===== 
 +  * If you can't get to the login then press ctrl+c right after /dev and sda3 is mounted. 
 +  * If your root file system is read-only then use ''mount -t ext3 -o rw,remount /dev/sda3 /'' to get write access. 
 +  * Current e2fsprogs 1.40.4 fails to build with following error: ''../../lib/libuuid.so: undefined reference to `___tls_get_addr' '' See http://bugs.gentoo.org/show_bug.cgi?id=204102 for more details. Workaround is to use version 1.40.3 by running ''echo '>=sys-fs/e2fsprogs-1.40.4' >> /etc/portage/package.mask'' before emerging. 
 +==== Installing an older package ==== 
 +Current version gentoo packages may not work on DSM-G600. 
 +If you gets Masked packages because of unsupported EAPI or package only support kernel 2.6, 
 +try to install an older package by browsing to /usr/portage///category/application// or going to the CSV tree : 
 +[[http://sources.gentoo.org/viewcvs.py/gentoo-x86/]
 +and searching older version of the package. 
 +Once the version found, install it with this command : 
 +<code> 
 +emerge -av =category/package-version 
 +</code> 
 + 
 +===== Links ===== 
 + 
 +  * [[http://dns323.kood.org/forum/t18-Gentoo-howto.html|Forum thread]] 
 +  * [[http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml?full=1|Gentoo handbook]]

Personal Tools