dsdt-initrd.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ACPI Custom DSDT read from initramfs
  2. 2003 by Markus Gaugusch < dsdt at gaugusch dot at >
  3. Special thanks go to Thomas Renninger from SuSE, who updated the patch for
  4. 2.6.0 and later modified it to read inside initramfs
  5. 2004 - 2008 maintained by Eric Piel < eric dot piel at tremplin-utc dot net >
  6. This option is intended for people who would like to hack their DSDT and don't
  7. want to recompile their kernel after every change. It can also be useful to
  8. distros which offers pre-compiled kernels and want to allow their users to use
  9. a modified DSDT. In the Kernel config, enable the initial RAM filesystem
  10. support (in General Setup) and enable ACPI_CUSTOM_DSDT_INITRD at the ACPI
  11. options (General Setup|ACPI Support|Read Custom DSDT from initramfs).
  12. A custom DSDT (Differentiated System Description Table) is useful when your
  13. computer uses ACPI but problems occur due to broken implementation. Typically,
  14. your computer works but there are some troubles with the hardware detection or
  15. the power management. You can check that troubles come from errors in the DSDT by
  16. activating the ACPI debug option and reading the logs. This table is provided
  17. by the BIOS, therefore it might be a good idea to check for BIOS update on your
  18. vendor website before going any further. Errors are often caused by vendors
  19. testing their hardware only with Windows or because there is code which is
  20. executed only on a specific OS with a specific version and Linux hasn't been
  21. considered during the development.
  22. Before you run away from customising your DSDT, you should note that already
  23. corrected tables are available for a fair amount of computers on this web-page:
  24. http://acpi.sf.net/dsdt . Be careful though, to work correctly a DSDT has to
  25. match closely the hardware, including the amount of RAM, the frequency of the
  26. processor and the PCI cards present! If you are part of the unluckies who
  27. cannot find their hardware in this database, you can modify your DSDT by
  28. yourself. This process is less painful than it sounds. Download the Intel ASL
  29. compiler/decompiler at http://www.intel.com/technology/IAPC/acpi/downloads.htm .
  30. As root, you then have to dump your DSDT and decompile it. By using the
  31. compiler messages as well as the kernel ACPI debug messages and the reference
  32. book (available at the Intel website and also at http://www.acpi.info), it is
  33. quite easy to obtain a fully working table.
  34. Once your new DSDT is ready you'll have to add it to an initramfs so that the
  35. kernel can read the table at the very beginning of the boot. As the file has to
  36. be accessed very early during the boot process the initramfs has to be an
  37. initramfs. The file is contained into the initramfs under the name /DSDT.aml .
  38. To obtain such an initramfs, you might have to modify your initramfs script or
  39. you can add it later to the initramfs with the script appended to this
  40. document. The command will look like:
  41. initramfs-add-dsdt initramfs.img my-dsdt.aml
  42. In case you don't use any initramfs, the possibilities you have are to either
  43. start using one (try mkinitrd or yaird), or use the "Include Custom DSDT"
  44. configure option to directly include your DSDT inside the kernel.
  45. The message "Looking for DSDT in initramfs..." will tell you if the DSDT was
  46. found or not. If you need to update your DSDT, generate a new initramfs and
  47. perform the steps above. Don't forget that with Lilo, you'll have to re-run it.
  48. ====================== Here starts initramfs-add-dsdt ==========================
  49. #!/bin/bash
  50. # Adds a DSDT file to the initrd (if it's an initramfs)
  51. # first argument is the name of archive
  52. # second argument is the name of the file to add
  53. # The file will be copied as /DSDT.aml
  54. # 20060126: fix "Premature end of file" with some old cpio (Roland Robic)
  55. # 20060205: this time it should really work
  56. # check the arguments
  57. if [ $# -ne 2 ]; then
  58. program_name=$(basename $0)
  59. echo "\
  60. $program_name: too few arguments
  61. Usage: $program_name initrd-name.img DSDT-to-add.aml
  62. Adds a DSDT file to an initrd (in initramfs format)
  63. initrd-name.img: filename of the initrd in initramfs format
  64. DSDT-to-add.aml: filename of the DSDT file to add
  65. " 1>&2
  66. exit 1
  67. fi
  68. # we should check it's an initramfs
  69. tempcpio=$(mktemp -d)
  70. # cleanup on exit, hangup, interrupt, quit, termination
  71. trap 'rm -rf $tempcpio' 0 1 2 3 15
  72. # extract the archive
  73. gunzip -c "$1" > "$tempcpio"/initramfs.cpio || exit 1
  74. # copy the DSDT file at the root of the directory so that we can call it "/DSDT.aml"
  75. cp -f "$2" "$tempcpio"/DSDT.aml
  76. # add the file
  77. cd "$tempcpio"
  78. (echo DSDT.aml | cpio --quiet -H newc -o -A -O "$tempcpio"/initramfs.cpio) || exit 1
  79. cd "$OLDPWD"
  80. # re-compress the archive
  81. gzip -c "$tempcpio"/initramfs.cpio > "$1"