1/* 2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 108 unchanged lines hidden (view full) --- 117 // to do this permanently, for but early bootup work 118 // it is helpful. 119 if (params()->early_kernel_symbols) { 120 kernel->loadGlobalSymbols(kernelSymtab, loadAddrMask); 121 kernel->loadGlobalSymbols(debugSymbolTable, loadAddrMask); 122 } 123 124 // Setup boot data structure |
125 Addr addr = 0; 126 // Check if the kernel image has a symbol that tells us it supports 127 // device trees. 128 bool kernel_has_fdt_support = 129 kernelSymtab->findAddress("unflatten_device_tree", addr); 130 bool dtb_file_specified = params()->dtb_filename != ""; |
131 |
132 if (kernel_has_fdt_support && dtb_file_specified) { 133 // Kernel supports flattened device tree and dtb file specified. 134 // Using Device Tree Blob to describe system configuration. 135 inform("Loading DTB file: %s\n", params()->dtb_filename); |
136 |
137 ObjectFile *dtb_file = createObjectFile(params()->dtb_filename, true); 138 if (!dtb_file) { 139 fatal("couldn't load DTB file: %s\n", params()->dtb_filename); 140 } 141 dtb_file->setTextBase(params()->atags_addr); 142 dtb_file->loadSections(physProxy); 143 delete dtb_file; 144 } else { 145 // Using ATAGS 146 // Warn if the kernel supports FDT and we haven't specified one 147 if (kernel_has_fdt_support) { 148 assert(!dtb_file_specified); 149 warn("Kernel supports device tree, but no DTB file specified\n"); 150 } 151 // Warn if the kernel doesn't support FDT and we have specified one 152 if (dtb_file_specified) { 153 assert(!kernel_has_fdt_support); 154 warn("DTB file specified, but no device tree support in kernel\n"); 155 } |
156 |
157 AtagCore *ac = new AtagCore; 158 ac->flags(1); // read-only 159 ac->pagesize(8192); 160 ac->rootdev(0); |
161 |
162 AddrRangeList atagRanges = physmem.getConfAddrRanges(); 163 if (atagRanges.size() != 1) { 164 fatal("Expected a single ATAG memory entry but got %d\n", 165 atagRanges.size()); 166 } 167 AtagMem *am = new AtagMem; 168 am->memSize(atagRanges.begin()->size()); 169 am->memStart(atagRanges.begin()->start); |
170 |
171 AtagCmdline *ad = new AtagCmdline; 172 ad->cmdline(params()->boot_osflags); |
173 |
174 DPRINTF(Loader, "boot command line %d bytes: %s\n", ad->size() <<2, params()->boot_osflags.c_str()); |
175 |
176 AtagNone *an = new AtagNone; |
177 |
178 uint32_t size = ac->size() + am->size() + ad->size() + an->size(); 179 uint32_t offset = 0; 180 uint8_t *boot_data = new uint8_t[size << 2]; |
181 |
182 offset += ac->copyOut(boot_data + offset); 183 offset += am->copyOut(boot_data + offset); 184 offset += ad->copyOut(boot_data + offset); 185 offset += an->copyOut(boot_data + offset); 186 187 DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2); 188 DDUMP(Loader, boot_data, size << 2); 189 190 physProxy.writeBlob(params()->atags_addr, boot_data, size << 2); 191 } 192 |
193 for (int i = 0; i < threadContexts.size(); i++) { 194 threadContexts[i]->setIntReg(0, 0); 195 threadContexts[i]->setIntReg(1, params()->machine_type); 196 threadContexts[i]->setIntReg(2, params()->atags_addr); 197 } 198} 199 200LinuxArmSystem::~LinuxArmSystem() --- 12 unchanged lines hidden --- |