LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-22-2006, 03:43 AM   #16
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45

Allright, now that you know how to install a distro to a mounted media, we will need to get it down to size. Go back to your downloaded slackware directory and remove all the packages you don't need. Just to boot, you will need all packages in the a/ directory and a few from l/. You can decide what other packages (if any) you want with the extra space available. Let's also bring your flash drive into the mix. 'umount' the partition from /mnt/slack and mount your flash drive there instead. Next, install all the packages from a/ and a few from l/. I don't remember all of the required packages needed from l/ but start with these
l/glib*
l/libtermcap
With these packages installed, you can 'chroot /mnt/slack' and find out which libraries your are missing by going to each of your directories with binaries and running 'ldd * | grep "not found"' (make sure to run 'ldconfig' before you do this). If you get any matches, use the Slackware package browser to find out which package you need.

read the /boot/README.initrd on how to set up an initrd, and make sure to install lilo to the MBR of /dev/sda. Here is an example lilo.conf (not tested, don't get mad if you have to fix a few things):
Code:
boot=/dev/sda
root=/dev/sda1
compact 

# boot partition
image=/boot/vmlinuz
label=USB Linux
root=/dev/sda1
read-only
initrd=/boot/initrd.img
You can use 'df /dev/sda1' to see how much space you have used up. If you are short on space, delete the man pages and /usr/doc directory.

If you run into any problems, holler back.

regards,
...drkstr

Last edited by drkstr; 07-22-2006 at 03:45 AM.
 
Old 07-23-2006, 03:17 AM   #17
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
re:how to boot a custom kernel built from slackware on a usb drive

well,
first I don't know how to remove packages. I have used installpkg to install packages but don't know how to un install.
and I will like to know what will actually be my root partition in the fstab.
my USB device is shown as /dev/sda1 so just /dev/sda wont work right?
and I will like to also know will it be ok if I just chroot into my thumb drive and just replace the kernel image and the modules in the lib directory with the once I compiled myself?
thanks,
Krishnakant
 
Old 07-23-2006, 04:07 AM   #18
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
first I don't know how to remove packages. I have used installpkg to install packages but don't know how to un install.
well you can remove packages with 'pkgtool' or 'removepkg', but I would recommend just reformatting the install media and starting clean.

Quote:
and I will like to know what will actually be my root partition in the fstab.
my USB device is shown as /dev/sda1 so just /dev/sda wont work right?
/dev/sda refers to the disk, /dev/sda1 refers to the partition (even if there is only one). When mounting (IE. your fstab), you need to refer to the partition. If you are installing lilo to the MBR of the disk, then you need to refer to /dev/sda.

Quote:
will like to also know will it be ok if I just chroot into my thumb drive and just replace the kernel image and the modules in the lib directory with the once I compiled myself?
I guess I don't really understanding what your asking. If you are asking if you can use your own kernel as apposed to the one in the a/ directory, then you need to replace the the kernel packages in that directory with packages you made from your own kernel. How to create your own Slackware packages. You can also copy the files manually, but this is not very good software management practice. None of this requires chroot however.

regards,
...drkstr
 
Old 07-23-2006, 11:34 AM   #19
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
re: how to boot a custom kernel built from slackware on a USB drive

I guess I don't really understanding what your asking. If you are asking if you can use your own kernel as apposed to the one in the a/ directory, then
you need to replace the the kernel packages in that directory with packages you made from your own kernel.
How to create your own Slackware packages.
You can also copy the files manually, but this is not very good software management practice. None of this requires chroot however.


well let me clearify my point.
I have built a custom kernel 2.6.16.18 and it is specially customised for my device which needs no pci no lan support and no ide disk access support.
it mainly has support for sound and USB.
it comes together at about 15 mb.
now I want to use this very kernel that I compiled and also the modules that I compiled with make modules command.
what my idea is to replace the original kernel image with my bz image which is just 800 kb and replace the modules in the similar way.
please tell me how I can do it.
thanks,
Krishnakant.
 
Old 07-23-2006, 01:14 PM   #20
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
what my idea is to replace the original kernel image with my bz image which is just 800 kb and replace the modules in the similar way.
please tell me how I can do it.
I allready did.

All you need to do is remove the default kernel packages from the a/ directory before you install, and then install your own kernel/modules in it's place. I would recommend packaging up your customer kernel in a .tgz before you do this, but it's not necessary.

Regards,
...drkstr
 
Old 07-23-2006, 03:19 PM   #21
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
re:how to boot a custom kernel built from slackware on a usb drive?

exactly the problem is that I use a cd burned from an ISO image which I downloaded from official slackware mirrors.
how will I modify the /a directory to have my own kernel?
I will create a .tgz package of my kernel and module but how to edit the /a directory?
or should I keep the customised kernel any where I choose and then use installpkg to install it?
secondly do I need to do any thing special to create a slackware kernel package or should I follow the usual steps?
and will the same method apply to developing a package containing all the modules for my custom kernel?
if I need to do any thing additional than usual while creating the modules.tgz file and kernel.tgz package then let me know.
thanks
Krishnakant.
 
Old 07-23-2006, 06:12 PM   #22
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
exactly the problem is that I use a cd burned from an ISO image which I downloaded from official slackware mirrors.
how will I modify the /a directory to have my own kernel?
Do you not have a hard drive? Why can't you just copy the slackware directory from the CD to your hard drive?

Quote:
secondly do I need to do any thing special to create a slackware kernel package or should I follow the usual steps?
and will the same method apply to developing a package containing all the modules for my custom kernel?
if I need to do any thing additional than usual while creating the modules.tgz file and kernel.tgz package then let me know.
Nothing special. Just place everything in a folder as it would appear on the root drive, then turn the folder into a package.

...drkstr
 
Old 07-24-2006, 04:06 PM   #23
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
lilo or extlinux for booting from USB drive?

hello drkstr,
all seams to be going on fine and I will be performing the final steps for USB stick tomorrow on my lab.
just las few questions to bother you.
first, what boot loader do you recommend as best?
do you or any one has any experience with extlinux which is similar to syslinux?
should I better go with lilo?
and yes I am still stuck with initrd for my USB stick.
I am also wondering if lilo will cause any problem booting from USB stick with my bz image and the modules which I have kept in my /lib/modules/2.6.18-embedded directory?
I do have a /boot folder on my USB stick and also created successfully, the kernel.tgz package which will be installing the kernel (bzimage) into /boot and the modules into /lib/modules/2.6.16.18-embedded directory.
in the etc directory I am creating the fstab, inittab and lilo.conf files.
do I need any more configuration files in /etc directory?
and lastly correct me if I am wrong.
I will be giving the following command to have lilo install in the mbr of my pen drive..
lilo /dev/sda.
and I am going to do this without mounting the USB pen drive.
and yes if there are some instructions for extlinux I will be happy to try them out as well.
thanks for your help and cooperation.
Krishnakant.
 
Old 07-24-2006, 09:35 PM   #24
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
do you or any one has any experience with extlinux which is similar to syslinux? should I better go with lilo?
You can use extlinux if you want, but I think lilo is more robust and is probably what I would use. You can get more info on extlinux here.

Quote:
I am also wondering if lilo will cause any problem booting from USB stick with my bz image and the modules which I have kept in my /lib/modules/2.6.18-embedded directory?
Well sort of. lilo will boot just fine with your kernel image in boot, but I'm not quite sure why you are placing your modules in a non standard directory. Your modules need to go in /lib/modules/2.6.18/.

Quote:
and yes I am still stuck with initrd for my USB stick.
What problems are you having? All the initrd is for is to load modules you need to mount your root partition (the USB stick in your case). If you have support for the root partition allready hard coded into the kernel, you do not need an initrd.

Quote:
in the etc directory I am creating the fstab, inittab and lilo.conf files.
only the fstab is necessary. inittab will be created when you install the a/ packages and lilo.conf is not needed since you will not need to install lilo from the system on your USB stick. Instead, you will be using the host system to install lilo on the MBR of the USB drive.

Quote:
do I need any more configuration files in /etc directory?
Yes! You need to install all of the packages from the a/ directory. This will create all of the files you will need.

Quote:
I will be giving the following command to have lilo install in the mbr of my pen drive.. lilo /dev/sda.
once the /etc/lilo.conf is configured correctly on your host system, you can install with just 'lilo'. Note: your USB drive must be mounted first. Also, make sure you remove the section that points to your host system before you install lilo.

regards,
...drkstr

Last edited by drkstr; 07-24-2006 at 09:38 PM.
 
Old 07-25-2006, 01:39 AM   #25
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
re:lilo or extlinux for booting from USB drive?

hello drkstr,
if lilo.conf is not present on my USB stick then how will the system boot?
it will be ok till I use my host system for development and testing.
but eventually the USB stick will will be set on to a single board computer where there is no host system. it does not even have a hard disk to have any kind of a boot loader.
every thing is supposed to be in the thumb drive.
thanks,
Krishnakant.
 
Old 07-25-2006, 01:59 AM   #26
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
if lilo.conf is not present on my USB stick then how will the system boot?
Your system doesn't boot from the lilo.conf, it boots from the lilo "binary" (for lack of a better term) installed on the USB's Master boot record by the host system. If you your BIOS is set to boot form the USB before the hard drive, it will boot from the lilo on the MBR of the USB stick. Likewise, if there is no hard disk.

Quote:
the USB stick will will be set on to a single board computer where there is no host system. it does not even have a hard disk to have any kind of a boot loader.
every thing is supposed to be in the thumb drive.
That's the idea

regards,
...drkstr

**edit**
I'm not sure what all the USB system will be doing, but if you ever have to "reinstall" lilo and don't want to plug it back into the host system, then you will need a lilo.conf (but you can create this later with 'liloconf' if you ever need it).

Last edited by drkstr; 07-25-2006 at 02:01 AM.
 
Old 07-26-2006, 04:04 PM   #27
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
booting of USB stick stuck for want of initrd

hi drkstr,
yes I wont ever plug my USB stick in the host system from where I installed the packages on USB stick.
and the boot loader has to do every thing form the USB stick.
and by the way I am not interested to change my lilo.con on the host system because it created some problems on my host.
second thing is I did read the readme.initrd file on the slackware cd, but I could not follow the instructions.
actually I have the 2.6.13 kernel by default on the system. this came with the cd. but for my device I did built the 2.6.16.18 kernel and so my lib directory of the host slackware system now has two directories in the /lib/modules directory. one is the default 2.6.13 and the other one 2.6.16.18 directory.
I also don't have a initrd image in /boot as my system never needed it.
so lilo.conf does not have it as well.
can you please guide me on the following issues?
1. I want to create an initrd for my USB stick with the mkinitrd command or any way possible from my host system where there is no such image by default.
2. now if I decide to put my lilo.conf file on the USB drive, how should it look like
my mount point for the USB stick is /mnt/usb and the device is loaded as /dev/sda1 so I think /dev/sda is the actuall (boot ) device for my USB linux right?
and I will place that BZImage I compiled with 2.6.16.18 kernel in the /boot directory of my USB thumb drive. and I will also keep initrd in /boot of the same drive.
how will the lilo. conf and the fstab look like?
I think fstab should mount the /dev/sda1 as defaults right?
3. I want to have ext3 file system on the pen drive and can't figure out how I can do it.
I first tried to partition the usb stick with cfdisk but it is not showing my thumb drive.
I need to figure out how my pen drive will be the target to fdisk or cfdisk.
it is /dev/sda1 as I said before.
and when I want to make it ext3 what is the command?
is it some thing similar to mke2fs?
thanks,
Krishnakant.
 
Old 07-26-2006, 05:22 PM   #28
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
and by the way I am not interested to change my lilo.con on the host system because it created some problems on my host.
OK, here's how it works. Back up your lilo.conf for the host system. Now edit configure original lilo.conf to install on the MBR of your USB drive. You need to remove any images that boot partitions on the host since it will not be relevent to the boot loader installed on the USB. your lilo.conf will probably look something like this: (plus any extra options you want)
Code:
boot=/dev/sda
compact 

# boot partition
image=/mnt/usb/boot/bzImage
label=USB Linux
root=/dev/sda1
read-only
initrd=/boot/initrd.img
note that the image= is not relative to where the kernel will be when there is no host system, this is merely telling lilo where it can find the kernel on the host system. lilo will use this info to install that kernel to the USB stick. Once lilo is installed correctly on the pen drive, it will be bootable independently (provided your BIOS supports this). After lilo is installed to the pen drive, restore the lilo.conf from the backup.

Your lilo.conf will not effect the booting whatsoever. It’s only purpose is to give lilo the instructions on where and what to install. You should never need a lilo.conf on the USB pen since the boot loader should not need to be changed. If I am to understand your project correctly, the pen drive will be used as a “utility” as apposed to a standard Linux system, witch means you only need to have enough on it to boot, and perform whatever tasks it needs to do. If this is the case, you will never need to compile programs, read man pages, or do any of the other things that you would find on a normal Linux system.

If down the line you realized you made a mistake and need to update something, (such as the installed boot loader) I would recommend plugging it back into the host system and making the required changes there.

For me, I like to start simple and add on more when I know I have a required step working. This is the basic process I followed when I did something similar (although it was not on a USB stick)

1. Install an entire slackware system to an ext3 partiin on the hard drive and see if it boots.
2. install a slimmed down version of slackware (a/ packages and a few from l/) to an ext3 partition on the hard drive and see if it boots
3. install the final cut down version with unneeded stuff stripped out of the base packages (man pages, docs, etc.)
4. install the same system from #3 on the pen drive and get it to boot

If you need to make corrections, update the .tgz package instead of the actual install, reformat and install everything again from your customized Slackware packages (note: you can unpack a .tgz with ‘tar –vxf package.tgz –C /destination/directory’ then make any changes and package it back up). The idea is to be able to install the entire system with one command, and not have to edit or create any extra files. This way, you can keep the final collection of packages on the host system and install it to as many pen drives as you wish.

Quote:
I want to create an initrd for my USB stick with the mkinitrd command or any way possible from my host system where there is no such image by default.
Yes, you just set up a directory with the needed files to boot, then use 'mkinitrd' with whatever options and modules you will need. I can't help you to much more then that since I just hard coded support for my root partition into the kernel. Again, you only need an initrd if you enabled support for the root partition as a modules.

Quote:
I will place that BZImage I compiled with 2.6.16.18 kernel in the /boot directory of my USB thumb drive. and I will also keep initrd in /boot of the same drive. how will the lilo. conf and the fstab look like?
Your fstab will look just like the fstab on the host system, just update the root partition to use /dev/sda1.

Quote:
want to have ext3 file system on the pen drive and can't figure out how I can do it.
I first tried to partition the usb stick with cfdisk but it is not showing my thumb drive.
I need to figure out how my pen drive will be the target to fdisk or cfdisk.
it is /dev/sda1 as I said before.
I'm not sure about this one, I've never used a USB stick before. I would try 'cfdisk /dev/sda' or if that doesn't work 'sfdisk -l /dev/sda'. The command you need to create the file system is 'mkfs.ext3 /dev/sda1'.

<whew>
Well I know I said I wouldn't write a book for you, but it look slike I ended up doing so anyways Hopefully you get some use from all this.

regards,
...drkstr
 
Old 07-30-2006, 04:03 PM   #29
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
following problems while booting USB with lilo.

hello drkstr,
I created my lilo.conf file as follows.
boot=/dev/sda
compact

# boot partition
image=/boot/bzImage
label=USB Linux
root=/dev/sda1
read-only
initrd=/boot/initrd.img
#end of lilo.conf
this is merely telling lilo where
it can find the kernel on the host system. lilo will use this info to install that kernel to the USB stick. Once lilo is installed correctly on the pen
drive, it will be bootable independently (provided your BIOS supports this).
yes all is fine but the thing is that my pen drive is not able to take all packages.
I went into the /a directory of my slackware packages and after mounting my pen drive I gave the following command.
installpkg -root /mnt/usb *.tgz for installing all packages.
the system hung up and there were no errors to trace.
I tried the -root /var/usblinux where usblinux was a folder I created.
it got installed to usblinux fine but when I tried to coppy the entire directory structure (75 mb) to my pen drive again the same problem.
I had formatted it with mkfs.ext3 command on /dev/sda1 as it is the only partition on the pen drive.
so I changed my mind unwillingly to partition the pen drive again and this time formatted it as fat (not fat 32). now the packages are getting installed directly to the pen drive.
what is this problem? should I try ext2 file system?
because I want lilo to run on my pen drive and when I tried it asked me if this is a ntfs or fat32 bootable. I don't know exactly what was the message but it asked me to enter yes or no.
secondly it givs error saying that USBLINUx can't be recognised.
it has a problem with the lable.
thirdly I want to know if I can create initrd by hand if I don't want to use the mkinitrd command?
and is it adviceable to have fat on the pen drive for booting?
or there is any other suggestion?
should I try syslinux for my booting needs?
thanks,
Krishnakant.
 
Old 07-30-2006, 07:37 PM   #30
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
I had formatted it with mkfs.ext3 command on /dev/sda1 as it is the only partition on the pen drive.
so I changed my mind unwillingly to partition the pen drive again and this time formatted it as fat (not fat 32). now the packages are getting installed directly to the pen drive.
what is this problem? should I try ext2 file system?
because I want lilo to run on my pen drive and when I tried it asked me if this is a ntfs or fat32 bootable. I don't know exactly what was the message but it asked me to enter yes or no.
ext3 might be a little heafty for a pen drive. I would give ext2 a try. Are you familure with a "journaling" file system? Well that's what ext3 is. While it's good for larger hardrives, with a lot of files, I don't think it would be benneficial in your case. Also, from what I have read, pen drives get along better with ext2.

Quote:
secondly it givs error saying that USBLINUx can't be recognised.
it has a problem with the lable.
thirdly I want to know if I can create initrd by hand if I don't want to use the mkinitrd command?
and is it adviceable to have fat on the pen drive for booting?
or there is any other suggestion?
That's odd that it would give you that error since USBLINUx is not the name of your label, it looks like "USB Linux" is. I would reformat the pen drive as ext2 and try again.

Quote:
should I try syslinux for my booting needs?
syslinux would be good if you decide to go with fat ...but I'm not sure why you would want to do this

ALso I noticed you lilo.conf doesn't point to the files in the correct place. It needs to be:
image=/mnt/usb/boot/bzImage
initrd=/mnt/usb/boot/initrd.img


and then you make sure that the kernel/initrd.img is in the /boot directory of you pen drive, and your pen drive is mounted to /mnt/usb.

Quote:
thirdly I want to know if I can create initrd by hand if I don't want to use the mkinitrd command?
I'm sure you could ...by why you would want to, I have no clue.




regards,
...drkstr
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to boot a custom kernel with extlinux on USB drive? krmane Linux - Software 2 07-16-2006 04:02 AM
Newly-Built Kernel Won't Boot, Old One Fails Kenji Miyamoto Slackware 6 05-27-2005 11:30 PM
Custom Built PC - No Monitor Signal Eklipz Linux - Hardware 12 12-25-2004 10:48 AM
Slackware 10- Please confirm my steps used to remove a module from a pre-built kernel jtp51 Slackware 7 11-03-2004 06:02 PM
Slackware 10, custom 2.6.7 kernel, lilo, loads kernel very slowly entropyv Slackware 3 08-19-2004 07:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration