about summary refs log blame commit diff stats
path: root/core/reboot.html
blob: ff659b41184cdedaa9cce06637dd63b6450deb35 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                              
 
                                        
 


                                                                  

             




                                                      

              

                                  
             



                                                  

              
                                               
 
                                                                             

             


                                                                   

              


                                                      

             
                                       
                  
                                                            




                                                        
                                                                           

              
                                                   





























                                                                                       

                                                           











                                                                      
                                            
















                                                                                                                          
                                              
                                             





                                                                                            
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset='utf-8'>
        <title>1.4. Prepare Reboot</title>
    </head>
    <body>

        <a href="index.html">Core OS Index</a>

        <h1>1.4. Prepare for Reboot</h1>

        <p>Follow this instructions with active chroot,
        first <a href="configure.html#chroot">mount partitions</a>
        and before chroot mount follow file systems;</p>

        <pre>
        $ sudo mount --bind /dev $CHROOT/dev
        $ sudo mount -vt devpts devpts $CHROOT/dev/pts
        $ sudo mount -vt tmpfs shm $CHROOT/dev/shm
        $ sudo mount -vt proc proc $CHROOT/proc
        $ sudo mount -vt sysfs sysfs $CHROOT/sys
        </pre>

        <p>Now you can chroot;</p>

        <pre>
        $ sudo chroot $CHROOT /usr/bin/env -i \
          HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
          PATH=/bin:/usr/bin:/sbin:/usr/sbin \
          /bin/bash --login
        </pre>

        <h2 id="linux">1.4.1. Linux Kernel</h2>

        <p>Install kernel with default crux configuration using pkgutils;</p>

        <pre>
        # cd /usr/ports/c9-ports/linux-crux
        # pkgmk -d
        # pkgadd /usr/ports/packages/linux-crux#4.1.30-1.pkg.tar.gz
        </pre>

        <h2 id="dracut">1.4.2. Dracut - Initramfs</h2>

        <p>Install dracut;</p>

        <pre>
        # cd /usr/ports/c9-ports/dracut
        # pkgmk -d
        # pkgadd /usr/ports/packages/dracut#044-2.pkg.tar.gz
        </pre>

        <p>Run dracut to create init ram filesystem;</p>

        <pre>
        # dracut -v -H --fstab  /boot/initramfs-4.1.30-crux.img 4.1.30-crux
        </pre>

        <h2 id="grub">1.4.3. Configuring Grub2</h2>

        <p>Create grub file in /etc/default/grub with values;</p>

        <pre>
        GRUB_DISABLE_LINUX_UUID=false
        GRUB_ENABLE_LINUX_LABEL=false
        </pre>

        <p><a href="http://www.gnu.org/software/grub/manual/grub.html">Grub Manual</a>,
        install grub on MBR of disk sdb;</p>

        <pre>
        # grub-install /dev/sdb
        Installation finished. No error reported.
        </pre>

        <p>If you are installing on removable media;</p>

        <pre>
        # grub-install --removable /dev/sdb
        Installation finished. No error reported.
        </pre>

        <p>grub-mkconfig generates grub.cfg, it will try to discover
        available kernels and attempt to generate menu entries for
        them;</p>

        <pre>
        # grub-mkconfig -o /boot/grub/grub.cfg
        Generating grub.cfg ...
        Found linux image: /boot/vmlinuz-4.1.30-crux
        Found initrd image: /boot/initramfs-4.1.30-crux.img
        done
        #
        </pre>

        <p>Check /boot/grub/grub.cfg, if is wrong add menu to
        /etc/grub.d/40_custom, replace correct msdos partition
        from grub-prob output and correct UUID from fstab or blkid</p>

        <pre>
        # grub-probe --target=hints_string /
        </pre>

        <h2 id="checkup">1.4.4. Checkup</h2>

        <p>If you have qemu installed you can see if it boots, in this
        example sdb is usb external drive;</p>

        <pre>
        # qemu-system-x86_64 -curses -usb -usbdevice disk:/dev/sdb
        </pre>

        <pre>
        # qemu-system-x86_64 -kernel /boot/vmlinuz-linux -initrd /boot/initramfs-linux.img -append root=/dev/sdb /dev/sdb2
        </pre>

	<pre>
	# qemu-img convert crux-img.qcow2 -O raw crux.img
	# dd if=crux.img of=/dev/sdX
	</pre>

        <a href="index.html">Core OS Index</a>
        <p>This is part of the c9-doc Manual.
        Copyright (C) 2016
        Silvino Silva.
        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
        for copying conditions.</p>
    </body>
</html>