LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to enable DMA at boot-up time (https://www.linuxquestions.org/questions/debian-26/how-to-enable-dma-at-boot-up-time-117732/)

reyemarr 11-19-2003 04:48 AM

How to enable DMA at boot-up time
 
Hi,
I installed hdparm in an attempt to set up DMA support. I manually enabled it on my hard drive, cdrom, and cdwriter without problems. But the way I have it now, I have to do it every time I shutdown/restart my system. Is there any way to enable DMA support at boot time automatically?

Thanks in advance

Quis 11-19-2003 05:05 AM

you can write a simple script like:

#!/bin/bash
hdparm -d /dev/hdX

and copy it to your init.d folder (as root),
don't forget to make it executeable,
and make a link in your rc3.d and/or rc5.d folder
ln -s /etc/init.d/[your_hdparm_script] /etc/rc5.d/SXXhdparm

reyemarr 11-19-2003 05:36 AM

Quis

Thanks for your quick response. But please keep in mind that I am a newbie. I do understand (kind off) what you said about making an executable script to run hdparm, but you totally lost me with the rc3.d and rc5.d thing. Could you please elaborate about those directories you mentioned??

PS. The symbolic link thing I do understand, so don't bother explaining that part.

Thanks a lot

Quis 11-19-2003 10:21 AM

the rcX.d folders include symlinks to the init.d folder.

each X representate a runlevel (most interesting runlevels are
1(single-user, no-networking, ..),
3(networking, text-based) and
5(X-server);
0 for halt and 6 for reboot (or vise versa, i am not sure).

the rcX.d-(runlevel)-folders are located in /etc/init.d, or maybe /etc.
this links have formats like SXX[name] and KXX[name]; S = start, K=kill;
the XX-number are for the execution-succession of the processes.

init.d contains all system-related deamons. they will be executed by the symlinks in the rcX.d-folders

you can create this script with an editor, then store it to [filename]
after this you set it to executeable with:
chmod -c 755 [filename]

seneca 11-19-2003 01:08 PM

Sorry to interrupt, Quis, but its much simplier to do
Code:

apt-get install hwtools
and then edit /etc/init.d/hwtools which is a prepared script. There's already a part called "hdparm optimization". You copy your usual hdparm commands in there, save, and then you're done.

reyemarr 11-19-2003 05:03 PM

Thanks guys

Tramontane 11-20-2003 04:02 PM

Quote:

Originally posted by seneca
Sorry to interrupt, Quis, but its much simplier to do
Code:

apt-get install hwtools
and then edit /etc/init.d/hwtools which is a prepared script. There's already a part called "hdparm optimization". You copy your usual hdparm commands in there, save, and then you're done.

this is from the Deb package documentation:
Code:

hwtools - Collection of tools for low-level hardware management

This package is a collection of tools useful for hardware troubleshooting
and optimization (for ix86 machines):

 irqtune: adjusts priority of interrupts (improves serial performance),
 scanport: scans for hardware not already handled by Linux drivers,
 memmxtest: a real mode memory test, with MMX support.  You may want
to look at package memtest86 as well.

Be aware that these tools require some knowledge of what are they doing to be used properly, not causing damage to your system.

Some programs that were previously part of this package have been moved to their own packages (hdparm, scsitools, memtest86)

That is from the current stable package(version 0.8-0.1). The "hdparm" package is suggested by "hwtools", though. I think he'll still need to get the "hdparm" package to do what you're saying. If he can accomplish what he wants to do by using a simple script, why should he go through the trouble of installing an unnecessary package(hwtools)?

llamakc 11-20-2003 05:02 PM

If you install hdparm via apt-get and check WHICH files that package includes via

dpkg -L hdparm

You'll see there's a script IN /etc/init.d already. After I installed the package, my hd maintained the optimized settings with subsequent boots.

HTH,

(PS: this is on Unstable)

reyemarr 11-21-2003 11:53 AM

Guys,

I followed your instructions about making a script to run hdparm at boot time, but still I havent been able to turn dma on automatically :-(. Here is what I did:

1. made a script called hdparm_init

d4500:/mnt/cdrom# more /root/scripts/hdparm_init
#!/bin/bash
/sbin/hdparm -d1 -m16 -c3 -u1 /dev/hda
/sbin/hdparm -d1 -c3 /dev/hdc
/sbin/hdparm -d1 -c3 /dev/hdd

2. made it executable
-rwxr-xr-x 1 root root 115 Nov 22 02:39 /root/scripts/hdparm_init

3. copied it to /etc/init.d/
d4500:/etc/init.d# ls -l hdparm_init
-rwxr-xr-x 1 root root 134 Nov 22 02:50 hdparm_init

4. made links to both rc3 and rc5 directories:
d4500:/etc/rc3.d# ls -l S15hdparm
lrwxrwxrwx 1 root root 23 Nov 22 01:54 S15hdparm -> /etc/init.d/hdparm_init
d4500:/etc/rc5.d# ls -l S15hdparm
lrwxrwxrwx 1 root root 23 Nov 22 01:57 S15hdparm -> /etc/init.d/hdparm_init

When the system boots up, I run hdparm /dev/hda to verify if dma was enabled and I get:
d4500:/mnt/cdrom# hdparm /dev/hda
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 9732/255/63, sectors = 156355584, start = 0
busstate = 1 (on)

And if I run the script manually, it works fine, and this is what I get:
d4500:/mnt/cdrom# /root/scripts/hdparm_init

/dev/hda:
setting 32-bit I/O support flag to 3
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
multcount = 16 (on)
I/O support = 3 (32-bit w/sync)
unmaskirq = 1 (on)
using_dma = 1 (on)

/dev/hdc:
setting 32-bit I/O support flag to 3
setting using_dma to 1 (on)
I/O support = 3 (32-bit w/sync)
using_dma = 1 (on)

/dev/hdd:
setting 32-bit I/O support flag to 3
setting using_dma to 1 (on)
I/O support = 3 (32-bit w/sync)
using_dma = 1 (on)



so the script seems to be ok
What am I doing wrong?????!!!!!!!

llamakc 11-21-2003 12:09 PM

Check /etc/inittab. You should be booting into Runlevel 2, which is the default. Link to there...

reyemarr 11-21-2003 12:29 PM

llamakc
That was right on the money. Thanks. Where can I get more information about what each init level does?

Again thanks

llamakc 11-21-2003 12:38 PM

man init is a great place to start.


All times are GMT -5. The time now is 03:48 PM.