mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-31 20:19:50 +00:00 
			
		
		
		
	The package contains u-boot and the RPi firmware blobs. It expects a tar ball of the root filesystem (including kernel and dtbs) on stdin and produces a compressed tar ball on stdout with the files to copy to a FAT32 formatted SD card. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
		
			
				
	
	
		
			30 lines
		
	
	
		
			909 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			909 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| set -e
 | |
| 
 | |
| # input is a tarball on stdin with kernel, dtbs and cmdline in /boot
 | |
| # output is an tar to be extracted onto a SD card
 | |
| 
 | |
| mkdir -p /files 
 | |
| cd /files
 | |
| 
 | |
| # extract. BSD tar auto recognises compression
 | |
| [ -t 0 ] || bsdtar xzf -
 | |
| 
 | |
| cd /
 | |
| 
 | |
| # copy/convert files 
 | |
| cp /files/boot/dtb/broadcom/bcm2837-rpi-3-b.dtb /boot
 | |
| /bin/mkimage -A arm64 -O linux -T kernel -C gzip -a 0x80000 -e 0x80000 \
 | |
|              -d /files/boot/kernel /boot/kernel.uimg >> /boot/uboot.log
 | |
| /bin/mkimage -A arm64 -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi3 \
 | |
|              -d /boot/boot.script /boot/boot.scr  >> /boot/uboot.log
 | |
| 
 | |
| # build an initrd and convert it
 | |
| rm -rf /files/boot
 | |
| cd /files && find . | cpio -o -H newc | gzip > /initrd.img
 | |
| /bin/mkimage -A arm64 -O linux -T ramdisk -d /initrd.img /boot/initrd.uimg  >> /boot/uboot.log
 | |
| 
 | |
| # now everything is setup in /boot just need to tar it
 | |
| cd /boot && tar cf - .
 |