LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-16-2006, 03:13 PM   #1
krmane
Member
 
Registered: May 2006
Posts: 49

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


hello,
I am a recent slackware user.
I had posted on this forum before but the answers did not satisfy my problem. it is my mistake though that I did not communicate my problem very well.
so here it is again.
I have a custom system to be built.
it is a device for the blind people. we are going to make it into a talking document reader which will read documetns off a usb drive into synthetic voice.
I already built a kernel with support for only sound, USB and other required things.
now I want to have my own kernel boot from my USB stic and by default log in as any user no problem if it is not root, but the user should not be prompted for user name and password.
actually it has a custom keyboard with just 4 arrows and enter and an escape key and may be one alt key.
and I wrote a menu based system using ncurses.
now I want that instead of bash this program run on my machine.
so firstly my problem is how to get my kernel boot on this USB stic. I know that the stick is bootable.
and my board has a bios that supports booting from USB.
IF POSSIBLE GIVE ME STEPS FOR GETTING MY KERNEL UP AND RUNNING ON MY usb STICK.
I don't want to use any other USB distro. I tried slacks but don't want to use it. I want my own kernel and own system because it is been asked by our organisation.
so please give me steps.
I will be useing extlinux as my boot loader. has any one tried it? how is it configured any example?
secondly, I need to know that after creating an ext3 partition, where do I keep the kernel's bz image? it is right now named as BZImage and was compiled by myself.
and I want to know how will I create my initrd for USB bootable from my existing slackware 10.2 and where to keep the initrd and the kernel.
and what all files apart from initrd and extlinux.conf will I need to create.
any example?
thanks,
Krishnakant.
 
Old 07-17-2006, 04:47 AM   #2
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Rep: Reputation: 62
I know you said you don't want to use "slacks" which i think you mean 'slax'

but they (slax) have the scripts on their web-site to do the boot-up on pen drive thing that you're looking for, tho it's only for particular kernels, but they give the code that they use if you want to use other kernels.

and from what I read of slax, they really only break apart from slackware for the most part once you get to the window manager.

I believe, they use the initialization scripts and accounting style, etc that slackware uses. Or should I say I assume they do, becuase they dont mention that those items are different.
 
Old 07-18-2006, 12:14 AM   #3
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?

Quote:
Originally Posted by Old_Fogie
I know you said you don't want to use "slacks" which i think you mean 'slax'
yes im sorry it was a typo.
but they (slax) have the scripts on their web-site to do the boot-up on pen drive thing that you're looking for, tho it's only for particular kernels, but they give the code that they use if you want to use other kernels.
can you provide me the URL?
and what if I want to use the kernel I have built?
and from what I read of slax, they really only break apart from slackware for the most part once you get to the window manager.
the point is that I don't want to use ext3 file system and not unionfs. and that's the major reason y I don't want to use any distro.
I believe, they use the initialization scripts and accounting style, etc that slackware uses. Or should I say I assume they do, becuase they dont mention that those items are different.
Please help me by explaining the initialisation scripts. I mean I know the /etc/fstab, but please explain a bit. and what other configuration files I must write by my hand?
and afterall it will be a nice studying experience for me to do it.
 
Old 07-18-2006, 12:33 AM   #4
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
Please help me by explaining the initialisation scripts. I mean I know the /etc/fstab, but please explain a bit. and what other configuration files I must write by my hand?
and afterall it will be a nice studying experience for me to do it.
We would have to write a book to explain the entire init process to you. In a nutshell, your /etc/rc.d/ contains all of your boot scripts. rc.S is the primary init script. From there it loads some helper scripts in the same directory. You will need to read them to find out what they do.

Once you have a working Linux distro you can boot to from your hard drive, and is configured the way you like it, you can download the Linux Live scripts from http://www.linux-live.org/. These are some helper scripts that converts your distro to a bootable cd or in your case, a bootable usb stick. For the scripts to work, you will need to enable unionFS and squashFS in your kernel. Instructions for this will be on the link I provided.

Give it a try, and if you run into any problems, or have any questions about any specific item, ask away. This will be your best bet since I doubt any one here will write a book for you. If all else fails, there's always google.com

regards,
...drkstr

Quote:
Originally Posted by Old_Fogie
Or should I say I assume they do, becuase they dont mention that those items are different.
AFAIK (I'm not sure if that's correct net-speak) I've actually been playing around a little with Slax today, and the init scripts do appear to be a little diffrent, but mostly the same. The biggest thing I noticed was the rc.inet1 script. The slax version seems to implement more of an auto detection method which actually detected my wireless pcmcia card and got me on the internet with no extra configuration. The only other changes were mainly in the initrd.gz image (which I found to be kind of a pain to modify). Over all though, pretty neat system.

Last edited by drkstr; 07-18-2006 at 02:09 AM.
 
Old 07-18-2006, 02:18 AM   #5
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Sorry to double post, just wanted to reply to something Fogie said real quick.
Quote:
Originally Posted by Old_Fogie
I believe, they use the initialization scripts and accounting style, etc that slackware uses. Or should I say I assume they do, becuase they dont mention that those items are different.
AFAIK (I'm not sure if that's correct net-speak) I've actually been playing around a little with Slax today, and the init scripts do appear to be a little different, but mostly the same. The biggest thing I noticed was the rc.inet1 script. The slax version seems to implement more of an auto detection method which actually detected my wireless pcmcia card and got me on the internet with no extra configuration. The only other major changes (that I noticed) were mainly in the initrd.gz image (which I found to be kind of a pain to modify). The initrd image brings up all the support for the "live" system. Pretty neat little trick in my opinion. To modify the initrd.gz you need to copy to another file and add an extra .gz to the end, then run 'gunzip initrd.gz.gz'. Then you can modify the files by:
Code:
mount -o loop initrd.gz /mnt_directory
I just made my first Live distro from my slack install a little bit ago and I haven't been able to get rid of the Slax logo in the initrd.gz, so gratiously implanted by the linux-live scripts, but all in good time...


regards,
...drkstr

Last edited by drkstr; 07-18-2006 at 02:21 AM.
 
Old 07-18-2006, 05:24 AM   #6
Old_Fogie
Senior Member
 
Registered: Mar 2006
Distribution: SLACKWARE 4TW! =D
Posts: 1,515

Rep: Reputation: 62
WOW GJ drkstr on the live cd
 
Old 07-19-2006, 01:35 AM   #7
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?

hello sorry for the trouble again.
all things said before are fine but I only have a single problem now.
I want an ext3 file system on my distro not unionfs. so if I can use any live scripts for this perpus please provide the URL.
and I don't want a complex system. just the normal slackware system and the same way of functioning.
I idealy will like to have my modules in the same place as my actual slackware box under /lib/ whatever. and the kernel and the initrd image in the /boot directory and the few configuration files which I will need as a minimum.
so please at least mention the minimum requirements to make such a system.
as I said I want a very plane and simple system. I will have a single user apart from root and I will like to have my executable programs in /sbin, /bin and /usr/locle/bin for that matter.
this is the exact setting I want
and I will allow users to create files by default in their home directory.
rather my device does not have a complete keyboard so changing directories away from the /home/user directory is impossible.
and again reminding that I want to run this system on ext3 or riser fs system.
Please help.
Krishnakant.
 
Old 07-19-2006, 02:24 AM   #8
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
I want an ext3 file system on my distro not unionfs.
unionfs is only used for the initial booting. If you have an /etc/fstab in your "live" root directory, it will remount the root file system accordingly after the initrd is finished booting.
Quote:
I don't want a complex system. just the normal slackware system and the same way of functioning.
I idealy will like to have my modules in the same place as my actual slackware box under /lib/ whatever. and the kernel and the initrd image in the /boot directory and the few configuration files which I will need as a minimum.
so please at least mention the minimum requirements to make such a system.
I would recommend installing a compleate Slackware install as a working host system, from the full Slackware system, install the base packages you want to a seperate partition using 'installpkg -root /path_to_custom_install package.tgz'. Once the packages are installed, you can use 'chroot /path_to_custom_install' to "jump" inside your custom install. Make any changes you want, then 'exit' and turn it into a live bootable distro with the linux-live scripts. If you are new to Linux then I would recommend following the live scripts. For a base system, install all the packages from the a/ directory, and a few from the l/. I'm not sure all the ones you will need from l/, but you will need glib* packages, libtermcap, and a couple others I don't remmber off the top of my head. If you run 'cd /bin ; ldd * | grep "not found"' (do this for all bin and sbin directories) while in the chroot environment, you will get any libraries you are missing. Just install the package that contains it. (make sure to run 'ldconfig' from within chroot after you install any libraries, or they will not show up with ldd)
Quote:
rather my device does not have a complete keyboard so changing directories away from the /home/user directory is impossible.
look up user permissions.

regards,
...drkstr

Last edited by drkstr; 07-19-2006 at 02:27 AM.
 
Old 07-20-2006, 01:05 PM   #9
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?

hello,
I have worked out the following solution, just correct me if I am going wrong.
I will first create an ext3 partition on my usb pen drive.
make a directory called /boot and put the kernel and the initrd files.
note that my kernel is a bz image.
then I will create the directory /lib
and then put the modules there.
then I will create /etc directory and put scripts for bootup and initialisation.
then I will run the extlinux boot loader and copy the mbr to the first sector of that usb stick.
will the above mentioned trick work?
or the other idea is
first I will use the installpkg -root /dev/sda1.
then chroot into /dev/sda1 and change what ever I need (/dev/sda1 is my usb drive) and then exit.
now if I use the live scripts is it gong to do any thing different?
or should I just install lilo or extlinux boot loader on the pen drive after I chroot and change and exit?
please guide in this regard.
thanks,
Krishnakant
 
Old 07-20-2006, 02:08 PM   #10
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Method 1:
Are you wanting to build your distro from scratch? You might want to check out www.linuxfromscratch.org

Method 2:
Right idea, but you need to make the following corrections.
Code:
mount -t auto /dev/sda1 /mnt/directory
installpkg -root /mnt/directory *.tgz
chroot /mnt/directory
This is your best bet since it sounds like you are somewhat new to Linux ( and I mean that with no disrespect).

Quote:
now if I use the live scripts is it gong to do any thing different?
or should I just install lilo or extlinux boot loader on the pen drive after I chroot and change and exit?
please guide in this regard.
the live scripts do whatever you tell it to (it creates the live install based on your system. You will need to read the documentation and go though the files to find out what it does, or you can follow this guide if you do not want to use live scripts http://feraga.com/node/25


regards,
...drkstr
 
Old 07-21-2006, 12:49 AM   #11
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?

hello,
thanks for your reply.
in your reply you mentioned the command installpkg which I know from my knowledge will install any tgz package.
now your command had the syntax,
installpkg -root /mnt/directory *.tgz which im sure is perfect.
however it will be nice if you could explain it a bit.
I am not really new to linux but very very new to slackware. and this is my first time around booting it from a pen drive and working with it like a system developer.
previously I was just a user and used to program in java.
and I think it was perfectly ok when u guessed that I am a new linux user.
I did not take any offence because it is a reality.
thanks again.Krishnakant.
 
Old 07-21-2006, 01:20 AM   #12
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
now your command had the syntax,
installpkg -root /mnt/directory *.tgz which im sure is perfect.
however it will be nice if you could explain it a bit.
Sure.
Code:
installpkg <see 1/> -root /mnt/directory </1> <see 2/>*.tgz</2>
1:
This installs the package into a specified directory instead of your root partition.

2:
this is the actual package you want to install. Using * will install all packages in a directory (I recommend this notation for the a/ directory) Alternitivly, you can install an individual package by replacing '*.tgz' with 'packagename.tgz'. The later notation would be better for installing select packages from l/ or any other directories that you might need packages from. You can also install all packages in all directories with
Code:
installpkg -root /mnt/directory ./*/*.tgz
This will install all the packages in any directory located in your current working directory ($PWD).

regards,
...drkstr
 
Old 07-21-2006, 02:49 PM   #13
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
can I use extlinux or grub on my slackware based USB distro?

Code:
installpkg <see 1/> -root /mnt/directory </1> <see 2/>*.tgz</2>
1:
This installs the package into a specified directory instead of your root partition.

2:
this is the actual package you want to install. Using * will install all packages in a directory (I recommend this notation for the a/ directory) Alternitivly, you can install an individual package by replacing '*.tgz' with 'packagename.tgz'. The later notation would be better for installing select packages from l/ or any other directories that you might need packages from. You can also install all packages in all directories with
Code:
installpkg -root /mnt/directory ./*/*.tgz
This will install all the packages in any directory located in your current working directory ($PWD).
So do I need my slackware cd set for doing this or will I be just installing packages exactly available on my system?
if I am in my /root directory, and if pwd is /root then the above command will install wich packages?
secondly, should I create the / directory along with /home/ and /bin, /lib, /var and /etc directories?
if I want my /dev/sda1 mounted by default on the / directory of that same usb drive (/dev/sda1) what should I do?
and yes one more very important point how and what should I do for my initrd? or will I not require to do it at all?should I use initrd and will grub or extlinux help me setup the bootup?
thanks
Krishnakant
 
Old 07-21-2006, 07:14 PM   #14
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
OK. Let’s start simple. Forget the USB drive for now, once you are used to installing a distro from another distro, you can add in the extra complexity.

Here is a hands on example of what you need to do. We are going to install a full Slackware distro on a free partition on your regular hard disk. Once you have done this successfully, you will have a better understanding of what you need to accomplish your goal.

1. Create a free partition I will call it /dev/hdaX (5 Gigs should do it)
2. Create a folder to mount it to, I will call it /mnt/slack
3. mount the folder with ‘mount –t auto /dev/hdaX /mnt/slack
4. download the entire slackware directory tree using a recursive wget (wget –r ftp://mirror.of.choice/slackware-10.2) or you can use your install CD
5. ‘cd’ to the slackware-10.2/slackware directory and install all the packages with ‘installpkg –root /mnt/slack */*.tgz’
6. copy the fstab form your host system to ‘/mnt/slack/etc/fstab’ then edit it so that /dev/hdaX will mount to /
7. add your new distro to your /etc/lilo.conf by copying the section that boots your host system. You will need to change the label to something like “Linux Test” and the image will be /mnt/slack/boot/vmlinuz, and root will be /dev/hdaX
8. install the lilo with ‘lilo’

Now when you reboot, you should have the option to pick wich distro you boot to. Let me know when you have this working. It will be much easier to help you when you have a better understanding of how the process works.

PS: don’t delete the Slackware packages you used to install, we will use this later when building your custom distro.

Regards,
…drkstr
 
Old 07-22-2006, 01:40 AM   #15
krmane
Member
 
Registered: May 2006
Posts: 49

Original Poster
Rep: Reputation: 15
your instructions worked now what next with USB?

[QUOTE=drkstr]OK. Let’s start simple. Forget the USB drive for now, once you are used to installing a distro from another distro, you can add in the extra complexity.
yes your suggestion is right.
Here is a hands on example of what you need to do. We are going to install a full Slackware distro on a free partition on your regular hard disk. Once you have done this successfully, you will have a better understanding of what you need to accomplish your goal.
yes I think that was some thing I missed out.

1. Create a free partition I will call it /dev/hdaX (5 Gigs should do it)
2. Create a folder to mount it to, I will call it /mnt/slack
3. mount the folder with ‘mount –t auto /dev/hdaX /mnt/slack
my new partition has ext3 partition.
4. download the entire slackware directory tree using a recursive wget (wget –r ftp://mirror.of.choice/slackware-10.2) or you can use your install CD
5. ‘cd’ to the slackware-10.2/slackware directory and install all the packages with ‘installpkg –root /mnt/slack */*.tgz’
this step went fine too!
6. copy the fstab form your host system to ‘/mnt/slack/etc/fstab’ then edit it so that /dev/hdaX will mount to /
7. add your new distro to your /etc/lilo.conf by copying the section that boots your host system. You will need to change the label to something like “Linux Test” and the image will be /mnt/slack/boot/vmlinuz, and root will be /dev/hdaX
8. install the lilo with ‘lilo’

Now when you reboot, you should have the option to pick wich distro you boot to. Let me know when you have this working. It will be much easier to help you when you have a better understanding of how the process works.
Yes this went successfully. thanks a lot.

PS: don’t delete the Slackware packages you used to install, we will use this later when building your custom distro.
This is one problem. I have a 256 mb pen drive and secondly I don't need all the packages for my custom distro.
and by the way I will need the particular initrd for a usb thumb drive.
so now since the distro is working on my hard drive, I will like to put on a usb drive.
 
  


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 03:02 AM
Newly-Built Kernel Won't Boot, Old One Fails Kenji Miyamoto Slackware 6 05-27-2005 10:30 PM
Custom Built PC - No Monitor Signal Eklipz Linux - Hardware 12 12-25-2004 09:48 AM
Slackware 10- Please confirm my steps used to remove a module from a pre-built kernel jtp51 Slackware 7 11-03-2004 05:02 PM
Slackware 10, custom 2.6.7 kernel, lilo, loads kernel very slowly entropyv Slackware 3 08-19-2004 06:06 PM


All times are GMT -5. The time now is 07:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration