https://wiki.archlinux.org/api.php?action=feedcontributions&user=Giner&feedformat=atomArchWiki - User contributions [en]2024-03-28T17:19:16ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Advanced_Format&diff=295183Advanced Format2014-01-31T15:13:08Z<p>Giner: /* Current HDD Models that Employ a 4k Sectors */ Update for WD20EARS</p>
<hr />
<div>[[Category:Storage]]<br />
==Introduction==<br />
The 'advanced format' feature reduces overhead by using 4 kilobyte sectors instead of the traditional 512 byte sectors. The old format gave a format efficiency of 87%. Advanced Format results in a format efficiency of 96% which increases space by up to 11%. The 4k sector is slated to become the next standard for HDDs by 2014.<br />
<br />
===More Detailed Explanation===<br />
The main idea behind using 4096-byte sectors is to increase the bit density on each track by reducing the number of gaps which hold Sync/DAM and ECC (Error Correction Code) information between data sectors. For eight 512-byte sectors, the track also holds eight sector gaps.<br />
<br />
By having one single sector of size 4096-byte (8 x 512-byte), the track holds only 1 sector gap for each data sector thus reducing an overhead for a need to support multiple Sync/DAM and ECC blocks and at the same time increasing bit density.<br />
<br />
Linux partitioning tools by default start each partition on sector 63 which leads to a bad performance in HDDs that use this 4K sector size due to misalignment to 4K sector from the beginning of the track.<br />
<br />
===External Links===<br />
*[http://www.anandtech.com/Show/Index/2888?cPage=2&all=False&sort=0&page=1 Western Digital’s Advanced Format: The 4K Sector Transition Begins]<br />
*[http://www.wdc.com/wdproducts/library/WhitePapers/ENG/2579-771430.pdf White paper entitled "Advanced Format Technology."]<br />
*Failure to align one's HDD results in poor read/write performance. See [http://www.linuxconfig.org/linux-wd-ears-advanced-format this article] for specific examples.<br />
<br />
==Current HDD Models that Employ a 4k Sectors==<br />
As of June 2011, there are a limited number of HDDs that support "Advanced Format" or 4k sectors as shown below.<br />
<br />
All drives in this list have a physical sector size of 4096 bytes, but not all drives correctly report this to the OS. The actual value reported (via new fields in the ATA-8 spec) is shown in the table as the physical reported sector size. As this is the value partitioning tools use for alignment, it is important that it should be 4096 to avoid misalignment issues.<br />
<br />
The logical sector size is the sector size used for data transfer. This value multiplied by the number of LBA sectors on the disk gives the disk capacity. Thus a disk with 4096 byte logical sectors will have a lower maximum LBA for the same capacity compared to a drive with 512 byte sectors. Drives with 512 byte logical sectors offer better compatibility with legacy operating systems (roughly those released before 2009) however drives with 4096 byte logical sectors may offer marginally better performance (e.g. more read/write requests may fit into the NCQ buffer.)<br />
<br />
{|class="wikitable"<br />
!rowspan=2| Manufacturer !!rowspan=2| Model !!rowspan=2| Capacity !!colspan=2| Reported sector size (bytes)<br />
|-<br />
! Logical !! Physical<br />
|-<br />
|colspan=5| '''3.5"'''<br />
|-<br />
| Western Digital || WD3000F9YZ || 2.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD30EZRX || 3.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD20EZRX || 2.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD30EZRSDTL || 3.0 TB<br />
|-<br />
| Western Digital || WD25EZRSDTL || 2.5 TB<br />
|-<br />
| Samsung || HD204UI || 2.0 TB || 512 || 512<br />
|-<br />
| Seagate || ST1000DL002 || 1.0 TB || 512 || 4096<br />
|-<br />
| Seagate || ST1000DM003 || 1.0 TB || 512 || 4096<br />
|-<br />
| Seagate || ST2000DL003 || 2.0 TB || 512 || 512<br />
|-<br />
| Seagate || ST2000DM001 || 2.0 TB || 512 || 4096<br />
|-<br />
| Seagate || ST3000DM001 || 3.0 TB || 512 || 4096<br />
|-<br />
| Seagate || ST4000VN000 || 4.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD20EARS || 2.0 TB || 512 || [http://community.wd.com/t5/Desktop-Mobile-Drives/Physical-Sector-Size-different-between-WD20EARS-00MVWB0-and/td-p/218226 4096] or [http://community.wdc.com/t5/Desktop/4k-sector-drive-reporting-512-byte-sectors-to-OS-why/td-p/205060 512]<br />
|-<br />
| Western Digital || WD20EARX || 2.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD20EFRX || 2.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD30EFRX || 3.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD15EARS || 1.5 TB || 512 || [http://excess.org/article/2010/11/wd-hdd-lying-about-4k-sectors/ 4096]<br />
|-<br />
| Western Digital || WD10EARS || 1.0 TB<br />
|-<br />
| Western Digital || WD10EURS || 1.0 TB<br />
|-<br />
| Western Digital || WD8000AARS || 800.0 GB<br />
|-<br />
| Western Digital || WD6400AARS || 640.0 GB<br />
|-<br />
|colspan=5| '''2.5"'''<br />
|-<br />
| Samsung || ST1000LM024|| 1.0 TB || 512 || 4096<br />
|-<br />
| Seagate || ST9750420AS || 750 GB || 512 || 4096<br />
|-<br />
| Western Digital || WD10JPVT || 1.0 TB || 512 || 4096<br />
|-<br />
| Western Digital || WD10TPVT || 1.0 TB<br />
|-<br />
| Western Digital || WD7500BPVT || 750.0 GB<br />
|-<br />
| Western Digital || WD7500KPVT || 750.0 GB<br />
|-<br />
| Western Digital || WD6400BPVT || 640.0 GB<br />
|-<br />
| Western Digital || WD5000BPVT || 500.0 GB<br />
|-<br />
| Western Digital || WD3200BPVT || 320.0 GB<br />
|-<br />
| Western Digital || WD2500BPVT || 250.0 GB || 512 || 4096<br />
|-<br />
| Western Digital || WD1600BPVT || 160.0 GB<br />
|-<br />
| TOSHIBA || MQ01ABD100 || 1.0 TB || 512 || 4096<br />
|}<br />
<br />
{{Note| Readers are encouraged to add to this table.}}<br />
<br />
== How to determine if HDD employ a 4k sector ==<br />
<br />
Tools which will report the physical sector of a drive (provided the drive will report it correctly) includes<br />
* smartmontools (since 5.41 ; <tt>smartmontools -a</tt>, in information section)<br />
* hdparm (since 9.12 ; <tt>hdparm -I</tt>, in configuration section)<br />
<br />
Note that both works even for USB-attached discs (if the USB bridge supports SAT aka SCSI/ATA Translation, ANSI INCITS 431-2007).<br />
<br />
==Aligning Partitions==<br />
<br />
{{Note|This should no longer require manual intervention. Any tools using recent libblkid versions are capable of handling Advanced Format automatically.}}<br />
<br />
Versions with this support include:<br />
<br />
* fdisk, since util-linux >= 2.15. You should start with ‘-c -u’ to disable DOS compatibility and use sectors instead of cylinders.<br />
* parted, since parted >= 2.1.<br />
* mdadm, since util-linux >= 2.15<br />
* lvm2, since util-linux >= 2.15<br />
* mkfs.{ext,xfs,gfs2,ocfs2} all support libblkid directly.<br />
<br />
Refer to [https://www.tolaris.com/2011/07/21/libblkid-or-why-you-dont-need-to-worry-about-4k-disk-format/ this page] for further information.<br />
<br />
===Check your partitions alignment===<br />
{{Note|This only works with [[MBR]], not [[GPT]].}}<br />
# fdisk -lu /dev/sda<br />
...<br />
# Device Boot Start End Blocks Id System<br />
# /dev/sda1 2048 46876671 23437312 7 HPFS/NTFS<br />
<br />
2048 (default since fdisk 2.17.2) means that your HDD is aligned correctly.<br />
Any other value divisible by 8 is good as well.<br />
<br />
===GPT (Recommended)===<br />
When using [[GPT]] partition tables, one need only use gdisk to create partitions which are aligned by default. For an example, see [[SSD#Detailed_Usage_Example]].<br />
<br />
===MBR (Not Recommended)===<br />
One can employ fdisk to align partitions to sector 2048 which will ensure that the partitions are aligned to the 4k sector. Interestingly, in sector mode, the default starting point is not 63 or 64 but 2048 in the current version of fdisk (2.17.2) so it is automatically taking care of the 4k sector size!<br />
<br />
# fdisk -c -u /dev/sda<br />
<br />
==Special Consideration for WD Green HDDs==<br />
<br />
FYI - this section has nothing to do with Advanced Format technology, but this is an appropriate location to share it with users. The WD20EARS (and other sizes include 1.0 and 1.5 TB driver in the series) will attempt to park the read heads once every 8 seconds FOR THE LIFE OF THE HDD which is just horrible! To see if you are affected use the smartctl command (part of smartmontools). If the last column changes rapidly, this section applies to your drive. <br />
# smartctl /dev/sdb -a | grep Load_Cycle<br />
193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 597115<br />
<br />
=== Disable via hdparm ===<br />
Use hdparm in {{ic|/etc/systemd/system/lcc_fix.service}} to disable this 'feature' and likely add life to your hdd:<br />
<br />
{{hc|/etc/systemd/system/lcc_fix.service |<nowiki><br />
[Unit]<br />
Description=WDIDLE3<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/hdparm -J 300 --please-destroy-my-drive /dev/sdX<br />
TimeoutSec=0<br />
StandardInput=tty<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Start the service<br />
# systemctl start lcc_fix.service<br />
<br />
Enable the service to autorun at boot.<br />
# systemctl enable lcc_fix.service<br />
<br />
==== Is this safe? ====<br />
Why do we need to pass the "--please-destroy-my-drive" flag? Here is an email from hdparm author, Mark Lord:<br />
<br />
> I have a Western DIgital \"Green\" drive (wd20ears). I noticed you added a -J switch and that <br />
> it is said to adjust the idle3 timeout. What frightens me is the output you gave it:<br />
> <br />
> How safe or not is this to use?<br />
<br />
I use it on my own drives. It works for me.<br />
<br />
If you can run the WDIDLE3.EXE MS-Dos program,<br />
then use it instead -- it was written by WD,<br />
and only they know how things really work there.<br />
<br />
If you cannot use the WDIDLE3.EXE, then you<br />
could consider "hdparm -J". It works for me,<br />
but it may or may not void some kind of warranty.<br />
<br />
Cheers<br />
-- <br />
Mark Lord<br />
Real-Time Remedies Inc.<br />
mlord@pobox.com<br />
<br />
=== Disable via changing firmware value (persistent) ===<br />
<br />
{{Warning|The tool used in this process is experimental, use at your own risk!}}<br />
<br />
{{Note|This method is persistant, you only need to do this once for every drive.}}<br />
<br />
This method will use a utility called idle3ctl to alter the firmware value for the idle3 timer on WD hard drives (similar to wdidle3.exe from WD). The advantage compared to the official utility is you do not need to create a DOS bootdisk first to change the idle3 timer value. Additionally idle3ctl might also work over USB-to-S-ATA bridges (in some cases).<br />
Download [http://idle3-tools.sourceforge.net/ idle3ctl], extract and compile it.<br />
Within the folder that contains the newly compiled binary, execute<br />
<br />
$ sudo ./idle3ctl -g /dev/your_wd_hdd<br />
<br />
to get the raw idle3 timer value.<br />
You can disable the Intellipark feature completely, with:<br />
<br />
$ sudo ./idle3ctl -d /dev/your_wd_hdd<br />
<br />
or set it to a different value (''0''-''255'') with (e.g. 10 seconds):<br />
<br />
$ sudo ./idle3ctl -s 100 /dev/your_wd_hd<br />
<br />
The range ''0''-''128'' is in 0.1s and ''129-255'' in 30s. For the chages to take effect, the drive needs to go through one powercycle, meaning powering it off and on again (on internal drives, a reboot is not sufficient).<br />
<br />
If your WD hard drive is not recognized, you can use the ''--force'' option. For more options see:<br />
<br />
$ ./idle3ctl -h</div>Ginerhttps://wiki.archlinux.org/index.php?title=Talk:Redmine&diff=251864Talk:Redmine2013-03-24T17:31:56Z<p>Giner: /* Installation steps */ add sqlite3</p>
<hr />
<div>==<s> Installation steps</s> ==<br />
<br />
I'm pretty sure you don't have to detail the steps for installing the package from the AUR. No other page does this. See [[Linux-ck]] and [[Courier_MTA]] for instance. I'd recommend copying the style of the Courier MTA article. [[User:SidK|SidK]] ([[User talk:SidK|talk]]) 15:27, 5 March 2013 (UTC) Sid<br />
: Fixed. Thanks for reporting. Close -- [[User:Fengchao|Fengchao]] ([[User talk:Fengchao|talk]]) 05:53, 15 March 2013 (UTC)<br />
<br />
== Sqlite 3 for production ==<br />
Why is sqlite3 not considered for production? sqlite3 is stable, pretty fast for minor installations and easy to backup. We have at least three production installation so far for a couple of years with no issues.</div>Ginerhttps://wiki.archlinux.org/index.php?title=Arch_build_system_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=75520Arch build system (Русский)2009-09-12T13:29:24Z<p>Giner: /* Что за файл PKGBUILD и что он содержит? */ подкоректирован перевод со страницы http://wiki.archlinux.org/index.php/ABS_PKGBUILD_Explained</p>
<hr />
<div>[[Category:Русский]]<br />
[[Category:Управление пакетами]]<br />
[[Category:Руководства]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|Česky|ABS - The Arch Build System (Česky)}}<br />
{{i18n_entry|English|ABS - The Arch Build System}}<br />
{{i18n_entry|繁體中文|ABS - The Arch Build System (繁體中文)}}<br />
{{i18n_entry|Русский|ABS - The Arch Build System (Russian)}}<br />
{{i18n_links_end}}<br />
<br />
==== Вступление ====<br />
<br />
Arch Build System ("Система Сборки для Arch", сокращенно ABS) используется для:<br />
* Создания новых пакетов программ, которых нет в Arch Linux<br />
* Пересборки существующих пакетов (включение или выключение опций сборки)<br />
* Перестройки всей системы с использованием новых флагов компиляции "a la freebsd" (и получение работающих модулей с Вашим новым ядром)<br />
<br />
ABS полезна, но не является необходимой для использования Arch Linux.<br />
<br />
Это описание - краткий обзор ABS и пакетов Arch Linux, а не полное руководство. Если Вы хотите узнать больше, обратитесь к man-страницам.<br />
<br />
<br />
<br />
==== Установка пакетов ====<br />
<br />
Для использования ABS Вы должны выполнить:<br />
<br />
<pre><br />
pacman -Sy abs<br />
</pre><br />
<br />
<br />
Или, если Вы уже имеете скачанные пакеты в каталоге 'foo' (например):<br />
<br />
<pre><br />
cd foo <br />
pacman -U abs-*.pkg.tar.gz<br />
</pre><br />
<br />
==== Что такое пакет? ====<br />
<br />
Обычно пакет — это файл вида ''foo''.pkg.tar.gz.<br />
<br />
Это просто архив tar.gz, который содержит:<br />
* Файлы для инсталляции<br />
* .PKGINFO : содержит все метаданные, необходимые для pacman, зависимости и т.п.<br />
* .INSTALL : содержит команды, запускаемые после инсталляции/обновления/деинсталляции. (Этот файл создается только если указан в PKGBUILD)<br />
<br />
==== Что за файл PKGBUILD и что он содержит?====<br />
<br />
Как упоминалось раньше, PKGBUILD содержит метаданные для пакета. Это простой текстовый файл, например:<br />
<br />
<pre><br />
# $Id: PKGBUILD,v 1.12 2003/11/06 08:26:13 dorphell Exp $<br />
# Maintainer: judd <jvinet@zeroflux.org><br />
# Contributor: Judd Vinet <jvinet@zeroflux.org><br />
pkgname=foo<br />
pkgver=0.99 # note: if the pkgver had been '0.99-10' then use an underscore. like '0.99_10'<br />
pkgrel=1<br />
pkgdesc="short description of foo"<br />
arch=(i686 x86_64)<br />
url="http://www.foo.org"<br />
license="GPL"<br />
groups=<br />
provides=<br />
depends=('qt' 'python')<br />
makedepends=('guile')<br />
conflicts=('yafoo')<br />
replaces=('mffoo')<br />
backup=('etc/foo/foo.conf')<br />
install=('foo.install')<br />
source=(http://www.foo.org/download/$pkgname-$pkgver.tar.gz)<br />
md5sums=('2c0cca3ef6330a187c6ef4fe41ecaa4d35175bee593a7cc7d6205584a94d8625')<br />
<br />
build() {<br />
cd $startdir/src/$pkgname-$pkgver<br />
./configure --prefix=/usr<br />
make || return 1<br />
make prefix=$startdir/pkg/usr install<br />
}<br />
</pre><br />
<br />
<br />
Итак, давайте рассмотрим каждое поле:<br />
<br />
* '''# text''' : комментарий<br />
* '''# $Id: PKGBUILD,v ...''' : cvs-tag для этого пакета (из archlinux-cvs)<br />
* '''# Maintainer''' : тот, кто в данный момент сопровождает пакет<br />
* '''# Contributor''' : все те, кто ранее сопровождали данный пакет<br />
* '''pkgname''' : название пакета<br />
* '''pkgver''' : версия пакета<br />
* '''pkgrel''' : номер релиза пакета. Он отличается от версии пакета тем, что он увеличивается при изменениях в PKGBUILD. Для этого есть несколько причин, например, Вы изменили какие-нибудь опции компиляции.<br />
* '''pkgdesc''' : короткое описание пакета. Его можно увидеть при просмотре [http://archlinux.org/packages/ базы пакетов]<br />
* '''arch''' : указывает, на каких архитектурах работает этот пакет. См. [[Arch64_FAQ]] для детальной информации<br />
* '''url''' : домашняя страница пакета (которая откроется, когда Вы кликните по имени пакета в базе пакетов)<br />
* '''license''' : лицензия, по которой распространяется программа<br />
* '''groups''' : используется для группы пакетов: например, когда Вы попробуете установить kde, будут установлены все пакеты, входящие в группу kde<br />
* '''provides''' : используется, если пакет обеспечивает другой пакет, например, kernel-scsi обеспечивает kernel <br />
* '''depends''' : список run-time зависимостей пакета (которые нужны для работы пакета)<br />
* '''makedepends''' : зависимости, нужные только для сборки пакета<br />
* '''conflicts''' : список пакетов, которые не могут существовать в системе одновременно с "нашим" пакетом<br />
* '''replaces''' : "наш" пакет заменяет указанный<br />
* '''backup''' : список файлов, которые необходимо сохранить (в виде file.pacsave) когда пакет будет деинсталлирован<br />
* '''install''' : указывает на специальный скрипт, который будет включен в пакет (должен быть в том же каталоге, где и PKGBUILD)<br />
* '''source''' : список адресов с исходниками(!) для пакета. Это могут быть и локальные файлы, и адреса в интернете. В именах можно использовать ''pkgver'' чтобы не изменять адрес каждый раз при изменении версии<br />
* '''md5sums''' : список контрольных сумм для исходников(!)<br />
<br />
<br />
Теперь рассмотрим функции:<br />
<br />
* '''build''' : все действия, необходимые для сборки пакета (более подробно будет рассмотрено позже) <br />
<br />
<br />
Итак, Вы видите, что PKGBUILD содержит всю информацию, необходимую для менеджера пакетов. Это сердце pacman и abs.<br />
<br />
<br />
Есть еще файлы install. Наш PKGBUILD указывает на 'foo.install' как на инсталляционный скрипт. Вот пример такого файла:<br />
<br />
<pre><br />
post_install() {<br />
/bin/true<br />
}<br />
<br />
post_upgrade() {<br />
/bin/true<br />
}<br />
<br />
pre_remove() {<br />
/bin/true<br />
}<br />
<br />
op=$1<br />
shift<br />
<br />
$op "$@"<br />
</pre><br />
<br />
<br />
Назначения функций:<br />
<br />
* '''post_install''' : этот скрипт будет выполнен сразу после инсталляции файлов, он принимает один аргумент : <br />
** версия пакета<br />
* '''post_upgrade''' : этот скрипт будет выполнен после обновления всех файлов, он получает два параметра :<br />
** новая версия пакета<br />
** старая версия пакета<br />
* '''pre_remove''' : этот скрипт будет выполнен перед удалением файлов (например, остановка демонов), он принимает один аргумент : <br />
** версия пакета<br />
<br />
Три строки в конце файла необходимы для правильной работы.<br />
<br />
==== Функция build====<br />
<br />
Если Вы не знакомы с построением пакетов, Вы должны знать, что большинство пакетов (но не все) могут быть построены следующим образом:<br />
<br />
* распаковка исходных файлов : <br />
<br />
<pre><br />
tar -xzf foo-0.99.tar.gz<br />
tar -xjf foo-0.99.tar.bz2</pre><br />
<br />
<br />
* переход в каталог<br />
<br />
<pre>cd foo-0.99</pre><br />
<br />
<br />
* конфигурирование: в общем случае, это небольшой скрипт <code>configure</code> в каталоге исходников, который используется для конфигурирования пакета (добавить или убрать возможности, изменить путь инсталляции и т.п.) и проверки, что в Вашей системе установлены все необходимые программы. Он может быть запущен так:<br />
<br />
<pre>./configure [[option]]</pre><br />
<br />
<br />
Вы можете сначала почитать подсказку: <br />
<br />
<pre>./configure --help</pre><br />
<br />
<br />
* компиляция программы :<br />
<br />
<pre>make</pre><br />
<br />
<br />
* инсталляция<br />
<br />
<pre>make install</pre><br />
<br />
<br />
<br />
Вы должны всегда читать файл <code>INSTALL</code>, чтобы знать, как надо собирать пакет. '''Не все пакеты используют систему <code>configure; make; make install</code>!'''<br />
<br />
Итак, взглянем на стандартное содержимое функции build:<br />
<br />
<pre><br />
build() {<br />
cd $startdir/src/$pkgname-$pkgver<br />
./configure --prefix=/usr<br />
make || return 1<br />
make prefix=$startdir/pkg/usr install<br />
}<br />
</pre><br />
<br />
Что мы делаем:<br />
<br />
* переходим в каталог, куда были распакованы исходники:<br />
<br />
<pre>cd $startdir/src/$pkgname-$pkgver</pre><br />
<br />
<br />
Когда Вы попробуете собирать свой пакет, удостоверьтесь, что это правильный каталог, иногда исходники распаковываются в другой каталог:<br />
<br />
<pre>tar -xzf foo-0.99.tar.gz</pre><br />
<br />
<br />
и <code>ls</code> может выдать:<br />
<br />
<pre><br />
.<br />
..<br />
foo-0.99.tar.gz<br />
foo/</pre><br />
<br />
<br />
а не:<br />
<br />
<pre><br />
.<br />
..<br />
foo-0.99.tar.gz<br />
foo-0.99/</pre><br />
<br />
<br />
* конфигурируем пакет и указываем, что он будет установлен в каталог <code>/usr</code> :<br />
<br />
<pre><br />
./configure --prefix=/usr</pre><br />
<br />
<br />
* компилируем<br />
<br />
<pre><br />
make || return 1</pre><br />
<br />
<br />
* инсталлируем программу, но не в <code>/usr</code>, а в <code>$startdir/pkg/usr</code>, чтобы pacman мог управлять файлами.<br />
<br />
<pre><br />
make prefix=$startdir/pkg/usr install</pre><br />
<br />
<br />
Здесь мы заставляем <code>make</code> устанавливать файлы пакета не в указанный при конфигурировании каталог <code>/usr</code>, а в специальный каталог <code>$startdir/pkg/usr</code>. Теперь, <code>makepkg</code> может увидеть все устанавливаемые файлы и собрать их в пакет.<br />
<br />
<br />
'''NOTE''': Не всегда <code>prefix</code> используется в <code>Makefile</code>; часто вместо этого используется <code>DESTDIR</code>. Если пакет создавался с помощью autoconf/automake, используйте <code>DESTDIR</code>, это [http://sources.redhat.com/automake/automake.html#Install указано] в документации. Проверьте генерируемый файл <code>filelist</code>. Если он пуст, попробуйте <code>make DESTDIR=$startdir/pkg install</code>. Если это не работает, то надо смотреть, как работает "<code>make <...> install=</code>".<br />
<br />
==== Дерево ABS====<br />
<br />
Когда Вы запускаете '''abs''' впервые<br />
<br />
<pre><br />
# abs</pre><br />
<br />
<br />
он синхронизирует то, что может быть названо "Дерево ABS", с arch сервером используя систему cvs. <br />
<br />
Что же такое дерево ABS? Оно находится в каталоге <code>/var/abs</code> и выглядит примерно так:<br />
<br />
<pre><br />
|-<br />
| -- base/<br />
|-<br />
| ||-- autoconf/<br />
|-<br />
| ||-- automake/<br />
|-<br />
| ||-- ...<br />
|-<br />
| -- devel/<br />
|-<br />
| -- ...<br />
|-<br />
| -- extra/<br />
|-<br />
| || -- daemons/<br />
|-<br />
| || || -- acpid/<br />
|-<br />
| || || || -- PKGBUILD<br />
... ... ... ...<br />
</pre><br />
<br />
<br />
Дерево ABS имеет ту же структуру, что и база пакетов:<br />
<br />
* Первый уровень каталогов - категории<br />
* Второй уровень каталогов - пакеты<br />
* PKGBUILD содержит всю информацию о пакете <br />
<br />
Исключение — один специальный каталог '''local'''. Это „ваш“ каталог, в нем вы можете делать что угодно. Остальные каталоги изменять нельзя.<br />
<br />
<br />
'''Примечание:''' Первая загрузка дерева будет происходить долго, затем будут только обновления. Но не пугайтесь, если у вас только модемное соединение - передается только текст, который сжимается при передаче.<br />
<br />
<br />
Теперь, когда мы знаем, что такое дерево ABS, как мы можем использовать его?<br />
<br />
==== Первое использование ABS: изменение пакета====<br />
<br />
Эта ситуация может возникнуть, когда Вы считаете, что официальные пакеты собраны с определенным количеством <code>--enable</code> или <code>--disable</code> опций и это не то, что выбрали бы Вы.<br />
<br />
Для примера возьмем пакет ''foo''. ''foo'' собран без поддержки '''arts'''. Допустим, мы хоти включить '''arts'''.<br />
<br />
Вот что мы будем делать:<br />
<br />
<br />
* находим, где расположен пакет ''foo''. Это можно сделать так:<br />
<br />
искать ''foo'' на [http://archlinux.org/packages.php]<br />
использовать find:<br />
<br />
<pre><br />
find /var/abs -name "foo"</pre><br />
<br />
<br />
использовать slocate:<br />
<br />
<pre><br />
slocate foo | grep ^/var/abs</pre><br />
<br />
<br />
В любом случае, мы должны обнаружить, что ''foo'' находится в <code>extra</code> и <code>multimedia</code><br />
<br />
<br />
* копируем ''foo'' файл <code>PKGBUILD</code> в <code>/var/abs/local/foo</code><br />
<br />
<pre><br />
mkdir /var/abs/local/foo<br />
cp /var/abs/extra/multimedia/foo/* /var/abs/local/foo<br />
cd /var/abs/local/foo</pre><br />
<br />
<br />
* изменяем <code>PKGBUILD</code>: добавляем поддержку '''arts''':<br />
<br />
<pre><br />
build() {<br />
cd $startdir/src/$pkgname-$pkgver<br />
./configure --prefix=/usr<br />
make || return 1<br />
make prefix=$startdir/pkg/usr install<br />
}</pre><br />
<br />
<br />
изменяем на:<br />
<br />
<pre><br />
build() {<br />
cd $startdir/src/$pkgname-$pkgver<br />
./configure --enable-arts --prefix=/usr<br />
make || return 1<br />
make prefix=$startdir/pkg/usr install<br />
}</pre><br />
<br />
<br />
* запускаем <code>makepkg</code> :<br />
<br />
<pre><br />
makepkg</pre><br />
<br />
<br />
* устанавливаем новый пакет используя одну из следующий команд: (<code>-A</code> для установки нового или <code>-U</code> для обновления уже установленного пакета):<br />
<br />
<pre><br />
pacman -A foo-*.pkg.tar.gz<br />
pacman -U foo-*.pkg.tar.gz</pre><br />
<br />
==== Флаги компиляции и настройка makepkg====<br />
<br />
Настроечный файл для <code>makepkg</code> — <code>/etc/makepkg.conf</code>. Здесь Вы можете установить переменные окружения для <code>gcc</code>, <code>make</code> и непосредственно <code>makepkg</code>. <br />
Это пример файла <code>/etc/makepkg.conf</code>:<br />
<br />
<pre><br />
# Программа, с помощью которой makepkg будет скачивать исходники<br />
export FTPAGENT="/usr/bin/wget --continue --passive-ftp --tries=3 --waitretry=3"<br />
<br />
# Информация для gcc о типе компьютера<br />
export CARCH="i686"<br />
export CHOST="i686-pc-linux-gnu"<br />
<br />
# Флаги компиляции для gcc<br />
export CFLAGS "-march athlon-tbird -O2 -pipe"<br />
export CXXFLAGS "-march athlon-tbird -02 -pipe"<br />
<br />
# Флаги для make<br />
export MAKEFLAGS="-j 2"<br />
<br />
# Расцветка вывода<br />
export USE_COLOR="y"<br />
<br />
# Оставшиеся переменные служат для настройки makepkg<br />
<br />
# Включить fakeroot для сборки пакетов непривилегированным пользователем.<br />
# 'man fakeroot' для информации<br />
export USE_FAKEROOT="y"<br />
<br />
# Каталог, куда будут сваливаться собранные пакеты (default is ./)<br />
export PKGDEST=/home/packages<br />
<br />
# Корень ABS дерева (default is /var/abs)<br />
export ABSROOT=/var/abs<br />
<br />
# Имя, которое будет фигурировать в Ваших пакетах <br />
export PACKAGER="John Doe <nowhere@microsoft.com>"<br />
</pre><br />
<br />
Пара слов предостережения: пользователи должны быть уверены, что изменения переменных <code>CFLAGS</code>, <code>CXXFLAGS</code>, и <code>MAKEFLAGS</code> не приведет к неработоспособности собираемых пакетов. Также, обычный пользователь Arch Linux не нуждается в изменении значений переменных <code>CARCH</code>, <code>CHOST</code> и <code>USE_FAKEROOT</code>.<br />
<br />
Ссылки на флаги gcc и make:<br />
* [[Safe_Cflags]]<br />
* [http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Option-Summary.html#Option-Summary]<br />
* [http://www.gnu.org/software/make/manual/html''chapter/make''9.html#SEC102]<br />
<br />
==== Дополнительно о ABS====<br />
<br />
Пара ссылок на wiki страницы, которые помогут лучше понять ABS:<br />
* [[The Arch package making HOW-TO - with guidelines]]<br />
* [[Custom local repository with ABS and gensync]]</div>Ginerhttps://wiki.archlinux.org/index.php?title=Smart_Common_Input_Method&diff=62028Smart Common Input Method2009-02-14T21:56:08Z<p>Giner: QT_IM_MODULE="scim-bridge" This configuration is working in Gnome, XFCE, LXDE with last updates on 2009.02.15 (scim 1.4.7-1, scim-bridge 0.4.15-1 from AUR)</p>
<hr />
<div>[[Category:Internationalization (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Scim}}<br />
{{i18n_entry|简体中文|SCIM 输入法 (简体中文)}}<br />
{{i18n_entry|正體中文|SCIM中文輸入法}}<br />
{{i18n_links_end}}<br />
<br />
= About SCIM =<br />
Su Zhe (or James Su)-who at that time worked for TurboLinux- started this project about 2001 with the goal:<br />
* Act as an unified frontend for current available input method libraries. Currently bindings to uim and m17n library are available.<br />
* Act as a language engine of IIIMF input method framework (TBD).<br />
* Provide as many native IMEngines as possible.<br />
* Support as many input method protocol/interface as possible.<br />
* Support as many operating systems as possible.<br />
<br />
SCIM has the following features:<br />
* Fully Object Oriented structure written in C++.<br />
* Highly modularized.<br />
* Very flexible architecture, can be used as a dynamically loaded library as well as a C/S input method environment.<br />
* Simple programming interface.<br />
* Fully i18n support with UCS-4/UTF-8 encoding.<br />
* Include many handy utility functions to speedup the development.<br />
* GUI Panel with very rich features.<br />
* Unified configuration framework.<br />
<br />
= Installing SCIM =<br />
# pacman -S scim<br />
== Installing Input Method Engines ==<br />
Currently the SCIM project has a wide range of input methods (some may need other libraries), covering more than 30 languages, including (Simplified/Traditional) Chinese, Japanese, Korean and many European languages.<br />
These are some of the examples (more can be found [http://www.scim-im.org/projects/imengines here]):<br />
<br />
Chinese Smart PinYin:<br />
# pacman -S scim-pinyin<br />
Chinese WuBi or other tables based:<br />
# pacman -S scim-tables<br />
Japanese:<br />
# pacman -S scim-anthy<br />
Korean:<br />
# pacman -S scim-hangul<br />
<br />
= Configure SCIM =<br />
<br />
Add the following lines to ~/.xinitrc before executing your DE/WM. If you want all the users of your system to use scim, place these lines in your /etc/profile.<br />
<br />
export XMODIFIERS=@im=SCIM<br />
export GTK_IM_MODULE="scim"<br />
export QT_IM_MODULE="scim"<br />
scim -d<br />
<br />
If ''export QT_IM_MODULE="scim"'' didn't work for you, you can use 'scim-bridge'' from AUR. This configuration is working in Gnome, XFCE, LXDE with last updates on 2009.02.15 (scim 1.4.7-1, scim-bridge 0.4.15-1 from AUR)<br />
<br />
export XMODIFIERS=@im=SCIM<br />
export GTK_IM_MODULE="scim"<br />
export QT_IM_MODULE="scim-bridge"<br />
scim -d<br />
<br />
If you use "scim -f socket -c socket -d" instead of<br />
"scim -d ",you cannot use scim in some qt program,<br />
like eva.<br />
<br />
For '''KDE''' you should either have ''scim-qtimm-cvs'' installed from AUR, or change QT IMM to '''xim'''. Like this:<br />
<br />
export QT_IM_MODULE="xim"<br />
<br />
<br />
<br />
This is what your .xinitrc file should look like. Note that the "exec ''DE/WM''" line comes '''after''' the lines for SCIM<br />
<br />
#!/bin/sh<br />
<br />
#<br />
# ~/.xinitrc<br />
#<br />
# Executed by startx (run your window manager from here)<br />
#<br />
<br />
# exec wmaker<br />
# exec startkde<br />
# exec icewm<br />
# exec blackbox<br />
# exec fluxbox<br />
<br />
# SCIM<br />
export XMODIFIERS=@im=SCIM<br />
export GTK_IM_MODULE="scim"<br />
export QT_IM_MODULE="scim"<br />
scim -d<br />
<br />
exec gnome-session<br />
<br />
If after you have install scim and the necessary input tables, and scim still doesn't work (click on the system tray, and nothing pops up), then you need to set the '''LC_CTYPE''' environmental variable in '''/etc/profile''' to the locale you plan to use. Simply create an entry for LC_CTYPE in /etc/profile, if there isn't one. <br />
<br />
eg. LC_CTYPE="zh_CN.utf8" //if you want to type simplified chinese<br />
<br />
Finally you need to generate the locale using the locale-gen command. Modify the /etc/locale.gen file to uncomment the language and encoding set you wish to use scim with. Then run the following command to generate the locale for your system.<br />
<br />
locale-gen<br />
<br />
To get scim working for me, I had to additionally add my current locale to /etc/scim/global (~/.scim/global should work too probably). Change the first line to include your locale. In my case it looks like this now:<br />
<br />
/SupportedUnicodeLocales = en_US.UTF-8,de_CH.UTF-8<br />
<br />
== Configure SCIM for GNOME with gdm ==<br />
This method seems to work with GNOME when logging in through gdm.<br />
<br />
1. Install ''scim'' and the relative input methods through pacman<br />
<br />
2. Insert the following lines at the end of your /etc/profile<br />
<br />
export XMODIFIERS=@im=SCIM<br />
export GTK_IM_MODULE="scim"<br />
export QT_IM_MODULE="scim"<br />
<br />
3. In your GNOME desktop, go to System > Preferences > Session and create a new command with the following line:<br />
<br />
scim -f x11 -c simple -d<br />
<br />
4. Restart your machine and enjoy!<br />
<br />
Note: I tried to put the first three lines in my .xinitrc instead of /etc/profile, but it didn't work for me.<br />
<br />
Note: If you use the line scim -f socket -c socket -d instead, the configuration of your SCIM will be unmodifiable.<br />
<br />
== Steps for KDE with kdm ==<br />
This method seems to work with KDE when logging in through kdm.<br />
<br />
1. Install '''scim''' and input engines.<br />
<br />
2. Create a new file called .xprofile in your home folder (~/.xprofile) and add the following lines:<br />
export XMODIFIERS=@im=SCIM<br />
export GTK_IM_MODULE=scim<br />
export QT_IM_MODULE=scim<br />
scim -f socket -c socket -d<br />
If you want all the users of your system to use scim, place these lines in your /etc/profile instead.<br />
<br />
Steps after this one are optional.<br />
<br />
3. Install '''skim''' from the [http://aur.archlinux.org/packages.php?ID=22652 AUR].<br />
<br />
4. Start '''SKIM''', right click on the system tray icon and click 'Configure'<br />
<br />
5. Under '''Frontend > X Window''', tick the checkbox for "Start skim automatically when KDE starts"<br />
<br />
6. Logout and restart X server (ctrl+alt+del), then login again<br />
<br />
In any application, press ''ctrl+space'' to activate the input window.<br />
<br />
<br />
<br />
[http://www.archlinux.org/news/166/ See the official news page for more details].<br />
<br />
[http://www.h4.dion.ne.jp/~apricots/scim-anthy/howto.html Complex SCIM Mandriva howto type Japaneese]</div>Giner