arch/powerpc/boot/mktree.c

Source file repositories/reference/linux-study-clean/arch/powerpc/boot/mktree.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/boot/mktree.c
Extension
.c
Size
3620 bytes
Lines
152
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (read(in_fd, tmpbuf, sizeof(tmpbuf)) < 0) {
			perror("zImage read");
			exit(5);
		}
		cp = tmpbuf;
		for (i = 0; i < sizeof(tmpbuf) / sizeof(unsigned int); i++)
			cksum += *cp++;
		if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) {
			perror("boot-image write");
			exit(5);
		}
	}

	/* rewrite the header with the computed checksum.
	*/
	bt.bb_checksum = htonl(cksum);
	if (lseek(out_fd, 0, SEEK_SET) < 0) {
		perror("rewrite seek");
		exit(1);
	}
	if (write(out_fd, &bt, sizeof(bt)) != sizeof(bt)) {
		perror("boot-image rewrite");
		exit(1);
	}

	exit(0);
}

Annotation

Implementation Notes