shithub: riscv

ref: aa623e87cf343b345ba87296d53710ea620212e4
dir: /sys/src/9/port/mkbootfs/

View raw version
#!/bin/rc
 
fn bootraw {
	proto=../port/bootfs.proto
	mkdir bootfs

	aux/stub /sys/log/timesync
	bind /dev/null /sys/log/timesync
	# make files writable for now.
	cat $proto | sed 's!d000!d775!;s!000!664!;s!555!775!;s!444!664!' > proto.cp
	disk/mkfs -a proto.cp | disk/mkext -d bootfs
	@{
		cd bootfs/386/bin
		strip * */* >[2]/dev/null || status=''
	}
	disk/mkfs -a -s bootfs proto.cp >boot.raw
	rm proto.cp
}

fn bootbz2 {
	aux/bflz -n 32 < boot.raw >boot.bflz
	bzip2 -9 < boot.bflz >boot.bz2
	rm boot.raw boot.bflz
}

fn rootbz2 {
	{
		echo bzfilesystem
		cat boot.bz2
		dd -if /dev/zero -bs 1024 -count 1 >[2]/dev/null
	} >rootfs.bz2
	ls -l rootfs.bz2
	rm boot.bz2
}

bootraw
bootbz2
rootbz2
rm -rf bootfs