요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=======================
ARM Linux 2.6 and upper
=======================
Please check <ftp://ftp.arm.linux.org.uk/pub/armlinux> for
updates.
Compilation of kernel
---------------------
In order to compile ARM Linux, you will need a compiler capable of
generating ARM ELF code with GNU extensions. GCC 3.3 is known to be
a good compiler. Fortunately, you needn't guess. The kernel will report
an error if your compiler is a recognized offender.
To build ARM Linux natively, you shouldn't have to alter the ARCH = line
in the top level Makefile. However, if you don't have the ARM Linux ELF
tools installed as default, then you should change the CROSS_COMPILE
line as detailed below.
If you wish to cross-compile, then alter the following lines in the top
level make file::
ARCH = <whatever>
with::
ARCH = arm
and::
CROSS_COMPILE=
to::
CROSS_COMPILE=<your-path-to-your-compiler-without-gcc>
eg.::
CROSS_COMPILE=arm-linux-
Do a 'make config', followed by 'make Image' to build the kernel
(arch/arm/boot/Image). A compressed image can be built by doing a
'make zImage' instead of 'make Image'.
Bug reports etc
---------------
Please send patches to the patch system. For more information, see
http://www.arm.linux.org.uk/developer/patches/info.php Always include some
explanation as to what the patch does and why it is needed.
Bug reports should be sent to [email protected],
or submitted through the web form at
http://www.arm.linux.org.uk/developer/
When sending bug reports, please ensure that they contain all relevant
information, eg. the kernel messages that were printed before/during
the problem, what you were doing, etc.
Include files
-------------
Several new include directories have been created under include/asm-arm,
which are there to reduce the clutter in the top-level directory. These
directories, and their purpose is listed below:
============= ==========================================================
`arch-*` machine/platform specific header files
`hardware` driver-internal ARM specific data structures/definitions
`mach` descriptions of generic ARM to specific machine interfaces
`proc-*` processor dependent header files (currently only two
categories)
============= ==========================================================
Machine/Platform support
------------------------
The ARM tree contains support for a lot of different machine types. To
continue supporting these differences, it has become necessary to split
machine-specific parts by directory. For this, the machine category is
used to select which directories and files get included (we will use
$(MACHINE) to refer to the category)
To this end, we now have arch/arm/mach-$(MACHINE) directories which are
designed to house the non-driver files for a particular machine (eg, PCI,
memory management, architecture definitions etc). For all future
machines, there should be a corresponding arch/arm/mach-$(MACHINE)/include/mach
directory.
Modules
-------
Although modularisation is supported (and required for the FP emulator),
each module on an ARM2/ARM250/ARM3 machine when is loaded will take
memory up to the next 32k boundary due to the size of the pages.
Therefore, is modularisation on these machines really worth it?
However, ARM6 and up machines allow modules to take multiples of 4k, and
as such Acorn RiscPCs and other architectures using these processors can
make good use of modularisation.
ADFS Image files
----------------
You can access image files on your ADFS partitions by mounting the ADFS
partition, and then using the loopback device driver. You must have
losetup installed.
Please note that the PCEmulator DOS partitions have a partition table at
the start, and as such, you will have to give '-o offset' to losetup.
Request to developers
---------------------
When writing device drivers which include a separate assembler file, please
include it in with the C file, and not the arch/arm/lib directory. This
allows the driver to be compiled as a loadable module without requiring
half the code to be compiled into the kernel image.
In general, try to avoid using assembler unless it is really necessary. It
makes drivers far less easy to port to other hardware.
ST506 hard drives
-----------------
The ST506 hard drive controllers seem to be working fine (if a little
slowly). At the moment they will only work off the controllers on an
A4x0's motherboard, but for it to work off a Podule just requires
someone with a podule to add the addresses for the IRQ mask and the
HDC base to the source.
As of 31/3/96 it works with two drives (you should get the ADFS
`*configure` harddrive set to 2). I've got an internal 20MB and a great
big external 5.25" FH 64MB drive (who could ever want more :-) ).
I've just got 240K/s off it (a dd with bs=128k); that's about half of what
RiscOS gets; but it's a heck of a lot better than the 50K/s I was getting
last week :-)
Known bug: Drive data errors can cause a hang; including cases where
the controller has fixed the error using ECC. (Possibly ONLY
in that case...hmm).
1772 Floppy
-----------
This also seems to work OK, but hasn't been stressed much lately. It
hasn't got any code for disc change detection in there at the moment which
could be a bit of a problem! Suggestions on the correct way to do this
are welcome.
`CONFIG_MACH_` and `CONFIG_ARCH_`
---------------------------------
A change was made in 2003 to the macro names for new machines.
Historically, `CONFIG_ARCH_` was used for the bonafide architecture,
e.g. SA1100, as well as implementations of the architecture,
e.g. Assabet. It was decided to change the implementation macros
to read `CONFIG_MACH_` for clarity. Moreover, a retroactive fixup has
not been made because it would complicate patching.
Previous registrations may be found online.
<http://www.arm.linux.org.uk/developer/machines/>
Kernel entry (head.S)
---------------------
The initial entry into the kernel is via head.S, which uses machine
independent code. The machine is selected by the value of 'r1' on
entry, which must be kept unique.
Due to the large number of machines which the ARM port of Linux provides
for, we have a method to manage this which ensures that we don't end up
duplicating large amounts of code.
We group machine (or platform) support code into machine classes. A
class typically based around one or more system on a chip devices, and
acts as a natural container around the actual implementations. These
classes are given directories - arch/arm/mach-<class> - which contain
the source files and include/mach/ to support the machine class.
For example, the SA1100 class is based upon the SA1100 and SA1110 SoC
devices, and contains the code to support the way the on-board and off-
board devices are used, or the device is setup, and provides that
machine specific "personality."
For platforms that support device tree (DT), the machine selection is
controlled at runtime by passing the device tree blob to the kernel. At
compile-time, support for the machine type must be selected. This allows for
a single multiplatform kernel build to be used for several machine types.
For platforms that do not use device tree, this machine selection is
controlled by the machine type ID, which acts both as a run-time and a
compile-time code selection method. You can register a new machine via the
web site at:
<http://www.arm.linux.org.uk/developer/machines/>
Note: Please do not register a machine type for DT-only platforms. If your
platform is DT-only, you do not need a registered machine type.
---
Russell King (15/03/2004)
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
ARM Linux 2.6 and upper
1-7이 문서는 ARM Linux 2.6 이상을 다룹니다. 최신 내용은 `ftp://ftp.arm.linux.org.uk/pub/armlinux`에서 확인합니다.
Compilation of kernel
8-46ARM Linux를 컴파일하려면 GNU 확장을 포함한 ARM ELF code를 생성할 수 있는 compiler가 필요합니다. GCC 3.3은 정상 동작하는 것으로 알려져 있으며, 알려진 문제 compiler를 쓰면 kernel build가 오류를 보고하므로 사용자가 추측할 필요는 없습니다.
ARM Linux host에서 native build할 때는 top-level Makefile의 `ARCH =` 줄을 보통 바꿀 필요가 없습니다. 다만 ARM Linux ELF 도구가 기본 도구로 설치되어 있지 않다면 아래 설명처럼 `CROSS_COMPILE`을 지정해야 합니다.
cross-compile할 때는 top-level make file에서 기존 architecture 값을 ARM으로 바꾸고 compiler executable의 `gcc` 앞부분까지를 prefix로 지정합니다.
ARCH = <whatever>
ARCH = arm
CROSS_COMPILE=
CROSS_COMPILE=<your-path-to-your-compiler-without-gcc>
예를 들어 일반적인 ARM Linux cross compiler prefix는 다음과 같습니다.
CROSS_COMPILE=arm-linux-
`make config`를 실행한 뒤 `make Image`로 `arch/arm/boot/Image`를 빌드합니다. 압축 image가 필요하면 `make Image` 대신 `make zImage`를 사용합니다.
Bug reports etc
47-62patch는 patch system으로 보내며, 무엇을 바꾸고 왜 필요한지 설명을 반드시 포함합니다. 자세한 절차는 `http://www.arm.linux.org.uk/developer/patches/info.php`를 참고합니다.
bug report는 `[email protected]` mailing list로 보내거나 `http://www.arm.linux.org.uk/developer/`의 web form으로 제출합니다. 문제 발생 전과 도중의 kernel message, 당시 수행 중이던 작업 등 관련 정보를 모두 넣어야 합니다.
Include files
63-78top-level 디렉터리의 혼잡을 줄이기 위해 `include/asm-arm` 아래에 여러 하위 include 디렉터리가 만들어졌습니다.
| 디렉터리 | 용도 |
|---|---|
| `arch-*` | machine 또는 platform별 header file |
| `hardware` | driver 내부용 ARM 전용 data structure와 definition |
| `mach` | generic ARM interface를 특정 machine에 연결하는 description |
| `proc-*` | processor 의존 header file로, 당시 두 category만 존재 |
Machine/Platform support
79-94ARM tree는 많은 machine type을 지원합니다. 차이를 계속 수용하기 위해 machine별 부분을 디렉터리로 나누며, machine category가 포함할 디렉터리와 file을 고릅니다. 여기서는 이 category를 `$(MACHINE)`으로 표기합니다.
`arch/arm/mach-$(MACHINE)`은 특정 machine의 driver가 아닌 file, 예를 들어 PCI·memory management·architecture definition을 담습니다. 앞으로 추가되는 모든 machine에는 대응하는 `arch/arm/mach-$(MACHINE)/include/mach` 디렉터리가 있어야 합니다.
Modules
95-107module 기능은 지원되며 FP emulator에는 필수이지만, ARM2·ARM250·ARM3 machine에서는 page 크기 때문에 load된 module 하나가 다음 32 KiB 경계까지 memory를 차지합니다. 이 machine에서 modularisation이 실제로 이득인지 따져야 합니다.
ARM6 이상 machine은 4 KiB 배수 단위로 module을 배치할 수 있으므로 Acorn RiscPC와 같은 해당 processor 기반 architecture는 module 기능을 효율적으로 사용할 수 있습니다.
ADFS Image files
108-118ADFS partition을 mount한 뒤 loopback device driver를 사용하면 partition 안의 image file에 접근할 수 있습니다. `losetup`이 설치되어 있어야 합니다.
PCEmulator DOS partition은 시작 부분에 partition table이 있으므로 `losetup`에 `-o offset`을 지정해야 합니다.
Request to developers
119-130별도 assembler file을 포함하는 device driver를 작성할 때 그 assembler를 `arch/arm/lib`에 두지 말고 C file과 함께 두십시오. 그래야 code 절반을 kernel image에 고정하지 않고도 driver 전체를 loadable module로 빌드할 수 있습니다.
정말 필요한 경우가 아니라면 assembler 사용을 피하는 것이 좋습니다. assembler는 driver를 다른 hardware로 port하기 훨씬 어렵게 만듭니다.
ST506 hard drives
131-152ST506 hard drive controller는 다소 느리지만 동작합니다. 당시에는 A4x0 motherboard의 controller에서만 동작했으며, Podule에서 사용하려면 해당 장치를 가진 개발자가 IRQ mask와 HDC base address를 source에 추가해야 했습니다.
1996년 3월 31일 기준 두 drive로 동작했으며 ADFS `*configure` harddrive를 2로 설정해야 했습니다. 시험 환경은 내부 20 MB drive와 외부 5.25-inch full-height 64 MB drive였습니다.
`dd`에서 `bs=128k`를 사용해 240 K/s를 얻었는데, 이는 RiscOS 성능의 약 절반이지만 전주의 50 K/s보다 크게 나아진 수치입니다.
알려진 bug: controller가 ECC로 오류를 수정한 경우를 포함해 drive data error가 hang을 일으킬 수 있습니다.
1772 Floppy
153-1601772 floppy도 정상 동작하는 것으로 보이지만 당시 최근에는 충분한 stress test를 거치지 않았습니다. disk change detection code가 아직 없어 문제가 될 수 있으며 올바른 구현 방법에 대한 제안을 요청합니다.
`CONFIG_MACH_` and `CONFIG_ARCH_`
161-1732003년에 새 machine용 macro 이름 규칙이 바뀌었습니다. 과거에는 SA1100 같은 실제 architecture와 Assabet 같은 그 architecture의 구현 모두에 `CONFIG_ARCH_`를 썼습니다. 의미를 명확히 하려고 구현 macro를 `CONFIG_MACH_`로 바꾸기로 했습니다.
기존 등록을 소급해 고치지는 않았습니다. 그러면 patch 적용이 복잡해지기 때문입니다. 이전 등록은 `http://www.arm.linux.org.uk/developer/machines/`에서 찾을 수 있습니다.
Kernel entry (head.S)
174-212kernel 최초 진입점은 machine-independent code인 `head.S`입니다. 진입 시 `r1` 값으로 machine을 고르며 이 값은 고유해야 합니다.
ARM port가 매우 많은 machine을 지원하면서 code 중복을 막기 위해 machine 또는 platform 지원 code를 machine class로 묶습니다. class는 보통 하나 이상의 SoC를 중심으로 하며 실제 구현을 담는 자연스러운 container입니다. `arch/arm/mach-<class>`에는 class source file과 이를 지원하는 `include/mach/`가 들어갑니다.
예를 들어 SA1100 class는 SA1100·SA1110 SoC에 기반하며 on-board와 off-board device 사용 방식, device 설정, machine별 특성을 지원하는 code를 포함합니다.
device tree(DT)를 지원하는 platform에서는 kernel에 device tree blob을 전달해 runtime에 machine을 선택합니다. compile time에는 해당 machine type 지원을 선택해야 하며, 이 방식은 하나의 multiplatform kernel build로 여러 machine type을 실행할 수 있게 합니다.
DT를 쓰지 않는 platform은 machine type ID로 runtime과 compile-time code를 모두 선택합니다. 새 machine은 `http://www.arm.linux.org.uk/developer/machines/`에서 등록할 수 있습니다.
DT 전용 platform에는 machine type을 등록하지 마십시오. DT-only platform에는 등록된 machine type이 필요하지 않습니다.
문서의 원 저자는 Russell King이며 표기된 날짜는 2004년 3월 15일입니다.
요약과 해설
arm.rst:1-212오래된 hardware 관련 역사적 내용도 포함하지만, 이 문서의 핵심은 ARM build 변수와 machine support의 조직 방식입니다. DT platform은 blob으로 runtime machine을 식별하고, non-DT platform은 `r1`의 고유 machine type ID를 사용합니다.
두 platform 계열은 compile-time 지원 선택은 공유하지만 runtime 식별 입력이 다릅니다.