Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (5) </ [1] 2 3 4 5 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Dummy USB re-compile for USB boot, kernel re-compile test how-to< Next Oldest | Next Newest >
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Nov. 29 2006,09:57 QUOTE

The idea behind this is to test whether you can re-compile your system (without changing anything) and then successfully reboot - if this works then you know that you are correctly set-up for the real thing. Thanks to ^thehatsrule^ for the help.

This was tested using DSL 3.0.1

Back-up your USB stick before proceeding at your own risk.


Materials required
-----------------
Download gcc-2.95.dsl, gcc1-with-libs.dsl & gnu-utils.dsl from the DSL repository
Download linux-2.4.26.tar.gz from "www.kernel.org" or mirror sites
Obtain knoppix 3.4 CD, download KNOPPIX_V3.4-2004-05-04-EN.iso from "http://www.pctips.pl/ftp/linux_342/Knoppix%203.4.html" or download kernelsource.dsl

Preparation
-----------
load required dsl packages:

# mydsl-load /path-to-file/gcc-2.95.dsl
# mydsl-load /path-to-file/gcc1-with-libs.dsl
# mydsl-load /path-to-file/gnu-utils.dsl

Create a directory for the kernel sources owned by user dsl:

# mkdir /usr/src
# chown dsl /usr/src

Copy the kernel sources to the new directory and un-pack them:

# cp /path-to-file/linux-2.4.26.tar.gz /usr/src/
# cd /usr/src
# tar -xzvf linux-2.4.26.tar.gz -C /usr/src
# rm linux-2.4.26.tar.gz

Copy the knoppix patch and configuration files from the CD or iso or dsl:

Either
# mkdir /ramdisk/image
# mount /path-to-file/KNOPPIX_V3.4-2004-05-04-EN.iso /ramdisk/image -t iso9660 -o loop,ro
# mkdir /ramdisk/unpack
# mount /ramdisk/image/KNOPPIX/KNOPPIX /ramdisk/unpack -t iso9660 -o ro,loop=/dev/cloop50
# cp /ramdisk/unpack/usr/src/* /usr/src
# cp /ramdisk/unpack/usr/src/linux-2.4.26/.* /usr/src
# umount /ramdisk/image
# umount /ramdisk/unpack
# rmdir /ramdisk/image
# rmdir /ramdisk/unpack

or
# mkdir /ramdisk/unpack
# mount /mnt/your-cd-drive/KNOPPIX/KNOPPIX /ramdisk/unpack -t iso9660 -o ro,loop=/dev/cloop50
# cp /ramdisk/unpack/usr/src/* /usr/src
# cp /ramdisk/unpack/usr/src/linux-2.4.26/.* /usr/src
# umount /ramdisk/unpack
# rmdir /ramdisk/unpack

or
# mkdir /ramdisk/unpack
# cp /path-to-file/kernelsource.dsl /ramdisk/unpack
# cd /ramdisk/unpack
# tar xvzf kernelsource.dsl
# cp /ramdisk/unpack/usr/src/* /usr/src
# cp /ramdisk/unpack/usr/src/linux-2.4.26/.* /usr/src
# rm -r /ramdisk/unpack

Apply the knoppix patch to the kernel sources:

# cd /usr/src
# patch -p1 -d linux-2.4.26 < knoppix-kernel.patch

Note that at this point in a "real re-compile" you would be ready to apply a kernel patch but, since this is a test, omit this step.

Recompile
---------
Prepare sources for re-compilation:

# cd /usr/src/linux-2.4.26
# make mrproper

Load the knoppix kernel configuration - note that at this point in a "real re-compile" you would be ready to change the kernel configuration, add modules, etc but, since this is a test, just load the knoppix kernel configuration and then save it.

# make menuconfig
Go to the last but one menu item <load an alternative configuration file>
tab to <select> and hit enter
replace text with "/usr/src/.config"
tab to <OK> and hit enter
tab to <exit> and hit enter (you will see "Do you wish to save your new kernel configuration?")
tab to <yes> and hit enter

Build dependencies and cleanup:

# make dep
# make clean

Build kernel boot image and copy to /boot:

# make bzImage
# make install

Note that at this point, if you had added additional loadable modules in a "real re-compile", you would issue the commands "make modules" and "make modules_install", but, since this is a test, omit this step.

Prepare to reboot
-----------------

copy kernel boot image to the root directory of your USB stick:

# cp /boot/vmlinuz-2.4.26 /path-to-boot-usb-root-dir/vmlinuz

make the boot image writeable (required for USB boot):

# rdev -R /path-to-boot-usb-root-dir/vmlinuz 0

Reboot
-------
Reboot as normal but when the first DSL screen appears requesting boot options, enter vmlinuz and hit enter.

If eveything went OK, DSL should now start up as usual.

If everything didn't go OK, then you could try deleting the boot option "quiet" from your syslinux.cfg file to get some clues as to what might have gone wrong...
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Nov. 29 2006,13:44 QUOTE

Your guide is pretty nicely written out :)

Just a couple comments...
Quote
Copy the kernel sources to the new directory and un-pack them:

# cp /path-to-file/linux-2.4.26.tar.gz /usr/src/
You don't necessarily need to use /usr/src/ here, esp. if that's on ramdisk or you don't have rw permissions (ie non-root user).  You'll only need to be a root user then when you `make install`

Code Sample
copy kernel boot image to the root directory of your USB stick:

# cp /boot/vmlinuz-2.4.26 /path-to-boot-usb-root-dir/vmlinuz

make the boot image writeable (required for USB boot):

# rdev -R /path-to-boot-usb-root-dir/vmlinuz 0
Did you try cp -a (archive mode)? It should preserve the permissions.
Back to top
Profile PM 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Dec. 07 2006,05:05 QUOTE

Ref "Did you try cp -a (archive mode)? It should preserve the permissions"

As far as I know (and I could so easily be wrong), the vmlinuz file is created ro - in a standard HD boot, the vmlinuz file is opened ro, some file integrity checks performed and then it is set rw.

I got the rdev command from an example of a floppy boot (circa 1993...) which stated that vmlinuz needed to be rw in order to work - this could be something to do with the differences between a floppy/USB filesystem (FAT) and a HD filesystem (ext2), but then again /ramdisk is ext2.

Anyway in USB boot terms, rdev works, cp -a doesn't seem to work :)
Back to top
Profile PM 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: April 20 2007,16:03 QUOTE

More post-compilation steps discussed here: http://damnsmalllinux.org/cgi-bin....28;st=0
Back to top
Profile PM 
curaga Offline





Group: Members
Posts: 2163
Joined: Feb. 2007
Posted: April 20 2007,16:35 QUOTE

Many Knoppix sites state that the Knoppix patch is to be applied after make menuconfig because it modifies something menuconfig will overwrite....

--------------
There's no such thing as life. Those mean little jocks invented it ;)
-
Windows is not a virus. A virus does something!
Back to top
Profile PM 
20 replies since Nov. 29 2006,09:57 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (5) </ [1] 2 3 4 5 >/
reply to topic new topic new poll
Quick Reply: Dummy USB re-compile for USB boot

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code