Difference between pages "Extlinux" and "Custom Profiles"

From Funtoo
(Difference between pages)
Jump to: navigation, search
(GPT)
 
 
Line 1: Line 1:
= What is ExtLinux? =
+
[[Category:Portage]]
 +
[[Category:Labs]]
 +
[[Category:HOWTO]]
 +
[[Category:Featured]]
  
ExtLinux is a pretty simple and modern systemloader, bundled with the syslinux tools, installation is really simple for it and fast, and thanks to our CoreTeam member Slashbeast the configuration runs automated in an awesome way.
+
Want to create your own custom profiles? Thought up a mix-in that's not currently in the Funtoo profiles? Have an overlay with profiles and want to make it easy for people to use them? Well you've come to the right place. This article will show you how to easily add you own profiles. No more ugly hacking of parent files and other nonsense. Once you follow this guide, not only will portage easily recognize your profiles, they will also show up in eselect right along with the ones from the main tree.
  
= Installing ExtLinux for funtoo =
+
== How to do it ==
 +
=== Rules to follow ===
 +
#For eselect support you will need the new version from funtoo. Currently >=eselect-1.3.1.1_rc2.
 +
#Your overlay must have a profiles directory. It must include a repo_name file with the name of your overlay.
 +
#Your profiles must be inside of the profiles directory
 +
#You need a profiles.eselect.desc file inside the profiles directory. See profiles.eselect.example in your funtoo portage tree for instructions
 +
#If your creating profiles of types arch, build, flavor, or mix-ins, your profile must be inside a directory with same name. Ex profiles/my_profile/flavor/new_profile, profiles/my_profile/mix-ins/subdir/profile.
 +
# Currently NoMix (see profiles.eselect.example) is only supported for profiles in the same tree.
 +
# If your not using a standard funtoo tree, you must insure that your main portage tree has 'profile-formats = portage-2' set in metadata/layout.conf in order for portage to interpret the <repo_name>:<profile> syntax.
 +
 +
=== Example of how to set up ===
 +
For our example we will create a mix-ins profile called 'fake_pro' in a local overlay called 'local_overlay'. fake_pro will set the 'dummy' USE flag globally and also set the 'fake' USE flag on sys-apps/not-exist. We will then add the profile to eselect so it's visible when running 'eselect profile'.
  
Installing ExtLinux for funtoo is known to work and supported too. If you like to try it just emerge syslinux
+
==== Creating the profile ====
 
+
We will use ${OVERLAY_DIR} as the path to local_overlay. These instructions assume the overlay exists.
<console>
+
If you haven't set a name for your overlay, do that first.
# ##i##emerge syslinux
+
<pre>
</console>
+
echo "local_overlay" > ${OVERLAY_DIR}/profiles/repo_name
 
+
</pre>
with that you have the complete syslinux tools installed. Another helpful tool you should merge with syslinux is slashbeast's lazykernel tool, so let us merge it too:
+
 
+
<console>
+
# ##i##emerge lazykernel
+
</console>
+
 
+
== Installing extlinux ==
+
 
+
to install extlinux just follow these steps:
+
 
+
<console>
+
# ##i##install -d /boot/extlinux
+
# ##i##extlinux --install /boot/extlinux
+
# ##i##cd /boot
+
# ##i##ln -s . boot
+
</console>
+
 
+
the next steps are different depending if you use an MBR or GPT setup and the HDD you installed on and want to boot from. Let us now for general take /dev/sda as your boot device.
+
 
+
=== MBR ===
+
 
+
If you set up your disk with MBR partition scheme just do the next steps:
+
 
+
<console>
+
# ##i##dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sda
+
# ##i##cp /usr/share/syslinux/menu.c32 /boot/extlinux/
+
# ##i##cp /usr/share/syslinux/libutil.c32 /boot/extlinux/
+
# ##i##touch /boot/extlinux/extlinux.conf
+
</console>
+
 
+
=== GPT ===
+
 
+
<console>
+
# ##i##sgdisk /dev/sda --attributes=1:set:2
+
# ##i##sgdisk /dev/sda --attributes=1:show
+
1:2:1 (legacy BIOS bootable)
+
# ##i##dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda
+
# ##i##cp /usr/share/syslinux/menu.c32 /boot/extlinux/
+
# ##i##cp /usr/share/syslinux/libutil.c32 /boot/extlinux/
+
# ##i##touch /boot/extlinux/extlinux.conf
+
</console>
+
 
+
== Setting up the Kernel ==
+
 
+
Now if you followed our advice to install lazykernel we have a pretty nice way to solve all the setup with a bit of prework and finish it then. If not you should go to the manual part. :)
+
 
+
=== lazykernel way ===
+
 
+
As you setup lazykernel, we now need to edit /etc/lazykernel.conf
+
 
+
make it to look like somethink like that:
+
  
 +
Next lets create a directory to store our profile. Since we're creating a 'mix-ins' profile we need to make sure our profile is inside a 'mix-ins' subdirectory. This is a requirement in order to ensure that the profile will show up in eselect. If your not planning on using eselect then there's no requirement to use 'mix-ins'
 
<pre>
 
<pre>
# After configuring, hash or remove line below.
+
install -d ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro
#CONFIGUREFIRST
+
 
+
# Number of the kernels to keep so `lazykernel clean` will not propose to remove them. Default: 3
+
keep_kernels=5
+
 
+
# Sort kernels by 'version' (biggest version first) or by 'mtime' (latest images first). Default: mtime
+
# Sorting by version may fail and 3.3.0-rc2 will be marked as newer than 3.3.0.
+
#sort_by='version'
+
sort_by=mtime
+
 
+
# The name for menu entry.
+
menu_entry_name="Funtoo Linux"
+
 
+
# Specify what initramfs image to use, if any. (Optional)
+
initramfs='initramfs.cpio.gz'
+
 
+
# Append kernel params, usualy you use it to specify rootfs device, but you can use it to pass switches to initramfs as well. (Optional)
+
#kernel_params='root=/dev/sda2'
+
#kernel_params="rootfstype=ext4 luks enc_root=/dev/sda2 lvm root=/dev/mapper/vg-rootfs uswsusp resume=/dev/mapper/vg-swap"
+
kernel_params="rootfstype=ext4 luks enc_root=/dev/sdb3 lvm root=/dev/mapper/vg-root uswsusp resume=/dev/mapper/vg-swap"
+
 
</pre>
 
</pre>
  
please make sure to comment out or delete the second line of the config file, else it will spit out an error for you... :)
+
Now that we have a directory for our profile, lets go ahead and add our settings. Global USE settings go in make.defaults, package specific USE settings go in package.use:
 
+
Now let us setup our kernel with lazykernel if you have a manual kernel just run:
+
 
+
<console>
+
# ##i##cd <kernel build dir>
+
# ##i##lazykernel auto
+
</console>
+
 
+
that will generate the modules for you, copy your kernel form /usr/src/linux over to /boot and generate the /boot/extlinux/extlinux.conf for you. The manual kernel will be the only supported one by lazykernel.
+
 
+
That's all you are ready to boot. :)
+
 
+
=== manual extlinux.conf ===
+
 
+
For other kernels, like those created by genkernel or by the binary USE-flag you need to edit your config by yourself. Just open /boot/extlinux/extlinux.conf in your favorite editor and setup something like the following:
+
 
+
 
<pre>
 
<pre>
TIMEOUT 30
+
cd ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro
UI menu.c32
+
echo 'USE="$USE dummy"' >> make.defaults
 
+
echo 'sys-apps/not-exist fake' >> package.use
MENU TITLE Boot Menu
+
MENU COLOR title        1;37;40
+
MENU COLOR border      30;40
+
MENU COLOR unsel        37;40
+
 
+
LABEL funtoo1
+
        MENU LABEL Funtoo Linux KERNEL-VERSION
+
        LINUX /<kernel>
+
        INITRD /<initramfs>
+
        APPEND rootfstype=ext4 luks enc_root=/dev/sdb3 lvm root=/dev/mapper/vg-root uswsusp resume=/dev/mapper/vg-swap
+
 
</pre>
 
</pre>
 +
Note that no matter if your using funtoo or gentoo, profile settings all work the same. For more information please check the portage man page.
  
That's all again you are ready for boot. You can also define several LABELs in that list to have multiple kernels been booted... :)
+
==== Adding to eselect ====
 
+
TBC
[[Category:HOWTO]]
+

Revision as of 17:31, 6 September 2012


Want to create your own custom profiles? Thought up a mix-in that's not currently in the Funtoo profiles? Have an overlay with profiles and want to make it easy for people to use them? Well you've come to the right place. This article will show you how to easily add you own profiles. No more ugly hacking of parent files and other nonsense. Once you follow this guide, not only will portage easily recognize your profiles, they will also show up in eselect right along with the ones from the main tree.

Contents

How to do it

Rules to follow

  1. For eselect support you will need the new version from funtoo. Currently >=eselect-1.3.1.1_rc2.
  2. Your overlay must have a profiles directory. It must include a repo_name file with the name of your overlay.
  3. Your profiles must be inside of the profiles directory
  4. You need a profiles.eselect.desc file inside the profiles directory. See profiles.eselect.example in your funtoo portage tree for instructions
  5. If your creating profiles of types arch, build, flavor, or mix-ins, your profile must be inside a directory with same name. Ex profiles/my_profile/flavor/new_profile, profiles/my_profile/mix-ins/subdir/profile.
  6. Currently NoMix (see profiles.eselect.example) is only supported for profiles in the same tree.
  7. If your not using a standard funtoo tree, you must insure that your main portage tree has 'profile-formats = portage-2' set in metadata/layout.conf in order for portage to interpret the <repo_name>:<profile> syntax.

Example of how to set up

For our example we will create a mix-ins profile called 'fake_pro' in a local overlay called 'local_overlay'. fake_pro will set the 'dummy' USE flag globally and also set the 'fake' USE flag on sys-apps/not-exist. We will then add the profile to eselect so it's visible when running 'eselect profile'.

Creating the profile

We will use ${OVERLAY_DIR} as the path to local_overlay. These instructions assume the overlay exists. If you haven't set a name for your overlay, do that first.

echo "local_overlay" > ${OVERLAY_DIR}/profiles/repo_name

Next lets create a directory to store our profile. Since we're creating a 'mix-ins' profile we need to make sure our profile is inside a 'mix-ins' subdirectory. This is a requirement in order to ensure that the profile will show up in eselect. If your not planning on using eselect then there's no requirement to use 'mix-ins'

install -d ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro

Now that we have a directory for our profile, lets go ahead and add our settings. Global USE settings go in make.defaults, package specific USE settings go in package.use:

cd ${OVERLAY_DIR}/profiles/my_profiles/mix-ins/fake_pro
echo 'USE="$USE dummy"' >> make.defaults
echo 'sys-apps/not-exist fake' >> package.use

Note that no matter if your using funtoo or gentoo, profile settings all work the same. For more information please check the portage man page.

Adding to eselect

TBC