Expand description
This is based on https://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#appendix_tag_reference. Please open a pull request for missing tags.
To get started with this crate, create a Atags
struct with a given memory position. The iter()
method will return an iterator that returns Atag
entries.
use atags::{Atag, Atags};
let mut buffer = [
// Core tag
0x00, 0x00, 0x00, 0x05, // size
0x54, 0x41, 0x00, 0x01, // tag
0x00, 0x00, 0x00, 0x01, // flags
0x00, 0x00, 0x10, 0x00, // page_size
0x12, 0x34, 0x56, 0x78, // root_device_number
// Empty tag
0x0, 0x0, 0x0, 0x0, // size
0x0, 0x0, 0x0, 0x0, // tag
];
let ptr = core::ptr::NonNull::new(buffer.as_mut_ptr()).unwrap();
let tags = unsafe { Atags::new(ptr.cast()) };
for tag in tags.iter() {
// first tag is a core tag
match tag {
Atag::Core(core) => {
assert_eq!(core.flags, 1);
assert_eq!(core.page_size, 0x1000);
assert_eq!(core.root_device_number, 0x12345678);
},
// Do something with the other tags
// In this example we only get 1 core tag and nothing else
_ => panic!("Unknown tag {:?}", tag),
}
}
§Features
§nightly
Will enable the nightly strict_provenance
feature in this crate.
Structs§
- Atag
Core - This tag must be used to start the list, it contains the basic information any bootloader must pass.
- Atag
Header - A raw headera. Used for debugging.
- Atag
Init Rd2 - Location of a compressed ramdisk image, usually combined with an
AtagRamDisk
. Can be used as an initial root file system with the addition of a command line parameter of ‘root=/dev/ram’. This tag supersedes the original ATAG_INITRD which used virtual addressing, this was a mistake and produced issues on some systems. All new bootloaders should use this tag in preference. - Atag
Iter - Iterator returned from
Atags
. YieldsAtag
entries. - Atag
Memory - Describes an area of physical memory the kernel is to use.
- Atag
RamDisk - Describes how the (initial) ramdisk will be configured by the kernel, specifically this allows for the bootloader to
ensure the ramdisk will be large enough to take the decompressed initial ramdisk image the bootloader is passing
using
AtagInitRd2
- Atag
Revision - Tag for the board revision
- Atag
Serial - Tag with 64 bit serial number of the board
- Atag
Video Lfb - Tag describing parameters for a framebuffer type display
- Atag
Video Text - Tag used to describe VGA text type displays.
- Atags
- Handler that points to a memory location that holds the tag definitions.
Enums§
- Atag
- Determines which tag is in the given memory region.