📄 linux.c
字号:
#include <config.h>#include <board.h>#include <string.h>#include <types.h>#include <setup.h>/* include/asm-arm/setup.h in linux *//* The list ends with an ATAG_NONE node. */#define ATAG_NONE 0x00000000struct tag_header { uint32 size; uint32 tag;};/* The list must start with an ATAG_CORE node */#define ATAG_CORE 0x54410001struct tag_core { uint32 flags; /* bit 0 = read-only */ uint32 pagesize; uint32 rootdev;};/* it is allowed to have multiple ATAG_MEM nodes */#define ATAG_MEM 0x54410002struct tag_mem32 { uint32 size; uint32 start; /* physical start address */};/* VGA text type displays */#define ATAG_VIDEOTEXT 0x54410003struct tag_videotext { uint8 x; uint8 y; uint16 video_page; uint8 video_mode; uint8 video_cols; uint16 video_ega_bx; uint8 video_lines; uint8 video_isvga; uint16 video_points;};/* describes how the ramdisk will be used in kernel */#define ATAG_RAMDISK 0x54410004struct tag_ramdisk { uint32 flags; /* bit 0 = load, bit 1 = prompt */ uint32 size; /* decompressed ramdisk size in _kilo_ bytes */ uint32 start; /* starting block of floppy-based RAM disk image */};/* describes where the compressed ramdisk image lives (virtual address) *//* * this one accidentally used virtual addresses - as such, * its depreciated. */#define ATAG_INITRD 0x54410005/* describes where the compressed ramdisk image lives (physical address) */#define ATAG_INITRD2 0x54420005struct tag_initrd { uint32 start; /* physical start address */ uint32 size; /* size of compressed ramdisk image in bytes */};/* board serial number. "64 bits should be enough for everybody" */#define ATAG_SERIAL 0x54410006struct tag_serialnr { uint32 low; uint32 high;};/* board revision */#define ATAG_REVISION 0x54410007struct tag_revision { uint32 rev;};/* initial values for vesafb-type framebuffers. see struct screen_info * in include/linux/tty.h */#define ATAG_VIDEOLFB 0x54410008struct tag_videolfb { uint16 lfb_width; uint16 lfb_height; uint16 lfb_depth; uint16 lfb_linelength; uint32 lfb_base; uint32 lfb_size; uint8 red_size; uint8 red_pos; uint8 green_size; uint8 green_pos; uint8 blue_size; uint8 blue_pos; uint8 rsvd_size; uint8 rsvd_pos;};/* command line: \0 terminated string */#define ATAG_CMDLINE 0x54410009struct tag_cmdline { char cmdline[1]; /* this is the minimum size */};/* acorn RiscPC specific information */#define ATAG_ACORN 0x41000101struct tag_acorn { uint32 memc_control_reg; uint32 vram_pages; uint8 sounddefault; uint8 adfsdrives;};/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */#define ATAG_MEMCLK 0x41000402struct tag_memclk { uint32 fmemclk;};struct tag { struct tag_header hdr; union { struct tag_core core; struct tag_mem32 mem; struct tag_videotext videotext; struct tag_ramdisk ramdisk; struct tag_initrd initrd; struct tag_serialnr serialnr; struct tag_revision revision; struct tag_videolfb videolfb; struct tag_cmdline cmdline; /* * Acorn specific */ struct tag_acorn acorn; /* * DC21285 specific */ struct tag_memclk memclk; } u;};struct tagtable { uint32 tag; int (*parse)(const struct tag *);};#define tag_next(t) ((struct tag *)((uint32 *)(t) + (t)->hdr.size))#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)extern void create_tags(void);static void setup_tag_core(uint32 rootdev, uint32 flags);//static void setup_tag_memory(uint32 start, uint32 size);//static void setup_commandline_tag(char *commandline);static void setup_tag_initrd2(uint32 start, uint32 size);static void setup_end_tag(void);static struct tag *tags;#define RAMDISK_MAJOR 1void create_tags(void){ tags = (struct tag *)BOOT_PARAMS; setup_tag_core(0, 0); setup_tag_initrd2(0xA1000000, 0x00420000); setup_end_tag(); return;}static void setup_tag_core(uint32 rootdev, uint32 flags){ tags->hdr.tag = ATAG_CORE; tags->hdr.size = tag_size(tag_core); tags->u.core.flags = flags; // not use. tags->u.core.pagesize = 0; // set read/write. tags->u.core.rootdev = 0; tags = tag_next(tags); return;}/*static void setup_tag_memory(uint32 start, uint32 size){ tags->hdr.tag = ATAG_MEM; tags->hdr.size = tag_size(tag_mem32); tags->u.mem.size = size; tags->u.mem.start = start; tags = tag_next(tags); return;}*/static void setup_tag_initrd2(uint32 start, uint32 size){ tags->hdr.tag = ATAG_INITRD2; tags->hdr.size = tag_size(tag_initrd); tags->u.initrd.start = start; tags->u.initrd.size = size; tags = tag_next(tags); return;}/*static void setup_commandline_tag(char *cmdline){ char *p=cmdline; while (*p == ' ') p++; tags->hdr.tag = ATAG_CMDLINE; tags->hdr.size = (sizeof(struct tag_header) + strlen(p) + 1 + 4) >> 2; strcpy(tags->u.cmdline.cmdline, p); tags = tag_next(tags); return;}*/static void setup_end_tag(void){ tags->hdr.tag = ATAG_NONE; tags->hdr.size = 0; return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -