WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Recompiling help  (Read 3763 times)

Offline valid

  • Newbie
  • *
  • Posts: 6
[SOLVED] Recompiling help
« on: February 10, 2011, 01:04:02 PM »
I'm trying to get a way to easily secure erase a whole bunch of HDDs (a small fast loading OS is a goal in this as I have a TON of drives). While the default micro core with the updated hdparm extension works fine with SATA drives, PATA drives wont wipe as config_ide_task_ioctl is turned off by default. Basically I'm just grabbing linux-2.6.33.3-patched.tbz2 and config-2.6.33.3-tinycore, setting 'config_ide_task_ioctl=y' and adding it to the extracted source as .config . Afterwards I run:

make oldconfig (runs fine)
make menuconfig (I turn off ACPI as I dont want it installed anyways)
make bzImage (I get a couple odd errors (like shifts of 32 when 31 is max val or size mismatches, but it seems to run and finish fine)

As I don't really need any more modules loaded then what tiny core already comes with I just replace the bzImage from the microcore iso from the site. When I go and try to run the image I get a crash with a stack/register dump that I can't read Followed by this error

Failed to open /dev/ramzswap0: No such device or address
swapon: /dev/ramzswap0: No such device or address

While I'm relatively comfortable in linux, I'm not that great at recompiling source, so any help I could get would be appreciated.
« Last Edit: February 11, 2011, 11:24:00 PM by valid »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Recompiling help
« Reply #1 on: February 10, 2011, 01:29:28 PM »
Hi valid
Why don't you just zero out the drives using dd?

Offline valid

  • Newbie
  • *
  • Posts: 6
Re: Recompiling help
« Reply #2 on: February 10, 2011, 01:42:13 PM »
Well I'm trying to conform to the 800-88 NIST spec for purging HDs and they are really pushing using secure-erase (dd doesn't wipe the HPA or bad sectors, not to mention it is quite a bit slower). Not using DOS because I'd like to add a program in that can talk to a SQL server reporting things like the serial# etc. As I'm using older comps to wipe running a Win-PE environment isn't ideal (slow...long loading).

Offline lolouis

  • Newbie
  • *
  • Posts: 43
Re: Recompiling help
« Reply #3 on: February 10, 2011, 01:59:11 PM »
As I don't really need any more modules loaded then what tiny core already comes with I just replace the bzImage from the microcore iso from the site. When I go and try to run the image I get a crash with a stack/register dump that I can't read Followed by this error

It would seem that just turning off ACPI in the kernel configuration should still allow you to use the old kernel modules that came with, but why not try:
Code: [Select]
make modules && make modules_installand see if replacing the old modules with the new ones changes things around?

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Recompiling help
« Reply #4 on: February 10, 2011, 02:28:26 PM »
You could try the boot option:
Code: [Select]
nozswapto see if you could possibly boot that way.

Of course in case that should work it would more be like curing a symptom rather than a cause.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline valid

  • Newbie
  • *
  • Posts: 6
Re: Recompiling help
« Reply #5 on: February 10, 2011, 02:33:07 PM »
You could try the boot option:
Code: [Select]
nozswapto see if you could possibly boot that way.

Of course in case that should work it would more be like curing a symptom rather than a cause.

Doesn't work. I think it is crashing before that, and it is unrelated....I'm rebuilding the modules now to see if that works...

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Recompiling help
« Reply #6 on: February 10, 2011, 04:15:12 PM »
Hi valid
I think you are mistaken, one of reasons dd is used is because it does raw reads and writes. The main
thing that will limit your speed is the speed of the drive. Running dd if=/dev/zero of=/dev/sda conv=noerror
will start writing at the very beginning of the drive and continue until it hits the end.
« Last Edit: February 10, 2011, 04:19:02 PM by Rich »

Offline valid

  • Newbie
  • *
  • Posts: 6
Re: Recompiling help
« Reply #7 on: February 10, 2011, 05:24:03 PM »
Well the HPA (host protected area) and blocks marked bad by the HD are invisible to the OS, and thus invisible to dd (say you have a 20GB drive and a 1GB HPA dd will think your HD is only 19GB - leaving 1GB untouched). While just writing zeros to every sector to the HD is good enough to thwart file recovery software, there technically is information untouched which could be recovered (either by removing the HPA (which probably wasn't used to store any real data) or removing all the remapped blocks, or through a laboratory style 'attack' (popping the cover off and looking at the physical platters with equipment).

While a pass with /dev/zero or /dev/urandom is plenty fine IMHO, when you are trying to conform to a spec, as pedantic as it may seem, you are limited in your options.
« Last Edit: February 10, 2011, 05:33:25 PM by valid »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Recompiling help
« Reply #8 on: February 10, 2011, 05:38:33 PM »
Well the HPA (host protected area) and blocks marked bad by the HD are invisible to the OS, and thus invisible to dd

depends...   ;)

http://bellet.info/laptop/t40.html#the_predesktop_area
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline valid

  • Newbie
  • *
  • Posts: 6
Re: Recompiling help
« Reply #9 on: February 10, 2011, 09:36:58 PM »
As I don't really need any more modules loaded then what tiny core already comes with I just replace the bzImage from the microcore iso from the site. When I go and try to run the image I get a crash with a stack/register dump that I can't read Followed by this error

It would seem that just turning off ACPI in the kernel configuration should still allow you to use the old kernel modules that came with, but why not try:
Code: [Select]
make modules && make modules_installand see if replacing the old modules with the new ones changes things around?

I guess I'm stuck understanding what I need to do after "make modules_install".....I'm not sure what that is doing looking at the makefile it is supposed to put something in the default location ('/'). I can't seem to find whatever it made and I don't know what I need to do with it. (The custom kernel wiki is a bit out of date and is only confusing me)

Offline lolouis

  • Newbie
  • *
  • Posts: 43
Re: Recompiling help
« Reply #10 on: February 11, 2011, 03:41:33 AM »
After running 'make modules' and 'make modules_install', if everything went well, the new modules will be found in /lib/modules/. It is always a good thing to rename the old module directory to something else, e.g. "modules.OLD",  before running the above commands, otherwise the old directory will be overwritten.
Once you have the new modules, you need to unpack the tinycore iso, unpack the tinycore filesystem (tinycore.gz) found in the iso, replace the old modules with the new ones, then repack the filesystem and finally create a new iso. I gather from your previous post that you already know how to extract the files from an .iso and repack it. I'll post the whole procedure here, just in case.

To get the tc filesystem (tinycore.gz) and all the other files (which you will need later) from the iso:

Code: [Select]
mkdir /mnt/tc-iso
mkdir /tmp/tc-filesystem
mount tinycore.iso /mnt/tc-iso -o loop,ro
cp -a /mnt/tc-iso/boot /tmp
mv /tmp/boot/tinycore.gz /tmp
umount /mnt/tc-iso

Now extract the tinycore.gz filesystem:

Code: [Select]
cd /tmp/tc-filesystem
zcat /tmp/tinycore.gz | sudo cpio -i -H newc -d

Now, remove the old modules in /tmp/tc-filesystem/lib/modules and copy there the new ones.

[By the way, and this is optional, if you wish to compress the new modules from x.ko to x.ko.gz (which is tinycore standard) you will need to use the program advdef, which is part of the advcomp.tcz extension. First gzip the new modules with 'gzip -2', then advdef them with 'advdef -z4']

Having replaced the modules, you are ready to repack the filesystem, thusly:

Code: [Select]
cd /tmp/tc-filesystem
find | cpio -o -H newc | gzip -2 > ../tinycore.gz
cd /tmp
advdef -z4 tinycore.gz

Now move the tinycore.gz compressed filesystem to the boot directory and create a new iso:

Code: [Select]
cd /tmp
mv tinycore.gz boot
mkdir newiso
mv boot newiso
mkisofs -l -J -R -V TC-custom -no-emul-boot -boot-load-size 4 -boot-info-table
-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o TC-remastered.iso newiso
rm -rf newiso

Note: the mkisofs command line is shown above in two lines (the 5th and 6th lines), but you need to enter it as ONE line.

This covers the whole process needed to unpack the iso, unpack the compressed tinycore filesystem, replace the modules in the tinycore filesystem, then recompress the filesystem and create a new iso.

Hope it helps.

Offline valid

  • Newbie
  • *
  • Posts: 6
Re: Recompiling help
« Reply #11 on: February 11, 2011, 11:23:38 PM »
That worked! Thanks a lot for your help everyone!