head	1.73;
access;
symbols
	RELENG_8_4:1.72.0.2
	RELENG_9_1_0_RELEASE:1.70.2.2.2.2
	RELENG_9_1:1.70.2.2.0.2
	RELENG_9_1_BP:1.70.2.2
	RELENG_8_3_0_RELEASE:1.62.6.4.2.1
	RELENG_8_3:1.62.6.4.0.2
	RELENG_8_3_BP:1.62.6.4
	RELENG_9_0_0_RELEASE:1.70.2.1.2.1
	RELENG_9_0:1.70.2.1.0.2
	RELENG_9_0_BP:1.70.2.1
	RELENG_9:1.70.0.2
	RELENG_9_BP:1.70
	RELENG_7_4_0_RELEASE:1.62.2.1.8.1
	RELENG_8_2_0_RELEASE:1.62.6.2.2.1
	RELENG_7_4:1.62.2.1.0.8
	RELENG_7_4_BP:1.62.2.1
	RELENG_8_2:1.62.6.2.0.2
	RELENG_8_2_BP:1.62.6.2
	RELENG_8_1_0_RELEASE:1.62.6.1.4.1
	RELENG_8_1:1.62.6.1.0.4
	RELENG_8_1_BP:1.62.6.1
	RELENG_7_3_0_RELEASE:1.62.2.1.6.1
	RELENG_7_3:1.62.2.1.0.6
	RELENG_7_3_BP:1.62.2.1
	RELENG_8_0_0_RELEASE:1.62.6.1.2.1
	RELENG_8_0:1.62.6.1.0.2
	RELENG_8_0_BP:1.62.6.1
	RELENG_8:1.62.0.6
	RELENG_8_BP:1.62
	RELENG_7_2_0_RELEASE:1.62.2.1.4.1
	RELENG_7_2:1.62.2.1.0.4
	RELENG_7_2_BP:1.62.2.1
	RELENG_7_1_0_RELEASE:1.62.2.1.2.1
	RELENG_6_4_0_RELEASE:1.62.4.1.2.1
	RELENG_7_1:1.62.2.1.0.2
	RELENG_7_1_BP:1.62.2.1
	RELENG_6_4:1.62.4.1.0.2
	RELENG_6_4_BP:1.62.4.1
	RELENG_6:1.62.0.4
	RELENG_7:1.62.0.2
	old_RELENG_7:1.60.0.2
	old_RELENG_7_BP:1.60
	old_RELENG_6_2_0_RELEASE:1.58
	old_RELENG_6_2:1.58.0.8
	old_RELENG_6_2_BP:1.58
	old_RELENG_5_5_0_RELEASE:1.56.2.2
	old_RELENG_5_5:1.56.2.2.0.4
	old_RELENG_5_5_BP:1.56.2.2
	old_RELENG_6_1_0_RELEASE:1.58
	old_RELENG_6_1:1.58.0.6
	old_RELENG_6_1_BP:1.58
	old_RELENG_6_0_0_RELEASE:1.58
	old_RELENG_6_0:1.58.0.4
	old_RELENG_6_0_BP:1.58
	old_RELENG_6:1.58.0.2
	old_RELENG_6_BP:1.58
	old_RELENG_5_4_0_RELEASE:1.56.2.2
	old_RELENG_5_4:1.56.2.2.0.2
	old_RELENG_5_4_BP:1.56.2.2
	old_RELENG_4_11_0_RELEASE:1.16.2.5
	old_RELENG_4_11:1.16.2.5.0.10
	old_RELENG_4_11_BP:1.16.2.5
	old_RELENG_5_3_0_RELEASE:1.56
	old_RELENG_5_3:1.56.0.4
	old_RELENG_5_3_BP:1.56
	old_RELENG_5:1.56.0.2
	old_RELENG_5_BP:1.56
	old_RELENG_4_10_0_RELEASE:1.16.2.5
	old_RELENG_4_10:1.16.2.5.0.8
	old_RELENG_4_10_BP:1.16.2.5
	old_RELENG_5_2_1_RELEASE:1.47
	old_RELENG_5_2_0_RELEASE:1.47
	old_RELENG_5_2:1.47.0.2
	old_RELENG_5_2_BP:1.47
	old_RELENG_4_9_0_RELEASE:1.16.2.5
	old_RELENG_4_9:1.16.2.5.0.6
	old_RELENG_4_9_BP:1.16.2.5
	old_RELENG_5_1_0_RELEASE:1.46
	old_RELENG_5_1:1.46.0.2
	old_RELENG_5_1_BP:1.46
	old_RELENG_4_8_0_RELEASE:1.16.2.5
	old_RELENG_4_8:1.16.2.5.0.4
	old_RELENG_4_8_BP:1.16.2.5
	old_RELENG_5_0_0_RELEASE:1.40.2.1
	old_RELENG_5_0:1.40.0.2
	old_RELENG_5_0_BP:1.40
	old_RELENG_4_7_0_RELEASE:1.16.2.5
	old_RELENG_4_7:1.16.2.5.0.2
	old_RELENG_4_7_BP:1.16.2.5
	old_RELENG_4_6_2_RELEASE:1.16.2.4
	old_RELENG_4_6_1_RELEASE:1.16.2.4
	old_RELENG_4_6_0_RELEASE:1.16.2.4
	old_RELENG_4_6:1.16.2.4.0.6
	old_RELENG_4_6_BP:1.16.2.4
	old_RELENG_4_5_0_RELEASE:1.16.2.4
	old_RELENG_4_5:1.16.2.4.0.4
	old_RELENG_4_5_BP:1.16.2.4
	old_RELENG_4_4_0_RELEASE:1.16.2.4
	old_RELENG_4_4:1.16.2.4.0.2
	old_RELENG_4_4_BP:1.16.2.4
	old_KSE_MILESTONE_2:1.22
	old_KSE_PRE_MILESTONE_2:1.22
	old_RELENG_4_3_0_RELEASE:1.16.2.3
	old_RELENG_4_3:1.16.2.3.0.2
	old_RELENG_4_3_BP:1.16.2.3
	old_RELENG_4_2_0_RELEASE:1.16.2.3
	old_RELENG_4_1_1_RELEASE:1.16.2.3
	old_PRE_SMPNG:1.19
	old_RELENG_4_1_0_RELEASE:1.16.2.3
	old_RELENG_3_5_0_RELEASE:1.11.2.2
	old_RELENG_4_0_0_RELEASE:1.16
	old_RELENG_4:1.16.0.2
	old_RELENG_4_BP:1.16
	old_RELENG_3_4_0_RELEASE:1.11.2.2
	old_RELENG_3_3_0_RELEASE:1.11.2.2
	old_RELENG_3_2_PAO:1.11.0.4
	old_RELENG_3_2_PAO_BP:1.11
	old_RELENG_3_2_0_RELEASE:1.11
	old_POST_VFS_BIO_NFS_PATCH:1.12
	old_PRE_VFS_BIO_NFS_PATCH:1.12
	old_POST_SMP_VMSHARE:1.12
	old_PRE_SMP_VMSHARE:1.12
	old_POST_NEWBUS:1.12
	old_PRE_NEWBUS:1.12
	old_RELENG_3_1_0_RELEASE:1.11
	old_RELENG_3:1.11.0.2
	old_RELENG_3_BP:1.11
	old_RELENG_3_0_0_RELEASE:1.7
	old_v1:1.1.1.1
	old_RNORDIER:1.1.1;
locks; strict;
comment	@# @;


1.73
date	2013.07.02.00.49.24;	author svnexp;	state Exp;
branches;
next	1.72;

1.72
date	2012.11.17.01.51.17;	author svnexp;	state Exp;
branches
	1.72.2.1;
next	1.71;

1.71
date	2012.02.28.18.30.18;	author dim;	state Exp;
branches;
next	1.70;

1.70
date	2011.09.13.14.03.55;	author avg;	state Exp;
branches
	1.70.2.1;
next	1.69;

1.69
date	2011.03.11.13.11.15;	author jhb;	state Exp;
branches;
next	1.68;

1.68
date	2011.02.27.02.06.09;	author dim;	state Exp;
branches;
next	1.67;

1.67
date	2011.02.20.19.33.47;	author dim;	state Exp;
branches;
next	1.66;

1.66
date	2011.01.05.21.46.08;	author dim;	state Exp;
branches;
next	1.65;

1.65
date	2010.10.08.10.27.52;	author pho;	state Exp;
branches;
next	1.64;

1.64
date	2010.09.24.19.49.12;	author pjd;	state Exp;
branches;
next	1.63;

1.63
date	2010.08.23.01.42.09;	author imp;	state Exp;
branches;
next	1.62;

1.62
date	2007.10.26.15.56.22;	author jhb;	state Exp;
branches
	1.62.2.1
	1.62.4.1
	1.62.6.1;
next	1.61;

1.61
date	2007.10.24.21.32.58;	author jhb;	state Exp;
branches;
next	1.60;

1.60
date	2007.05.19.05.07.47;	author kan;	state Exp;
branches;
next	1.59;

1.59
date	2005.07.15.12.22.14;	author ache;	state Exp;
branches;
next	1.58;

1.58
date	2005.03.15.18.43.36;	author obrien;	state Exp;
branches;
next	1.57;

1.57
date	2004.08.27.15.01.56;	author yar;	state Exp;
branches;
next	1.56;

1.56
date	2004.07.30.04.27.20;	author kan;	state Exp;
branches
	1.56.2.1;
next	1.55;

1.55
date	2004.02.17.07.13.03;	author ru;	state Exp;
branches;
next	1.54;

1.54
date	2004.02.09.14.11.56;	author ru;	state Exp;
branches;
next	1.53;

1.53
date	2004.02.07.23.30.45;	author ru;	state Exp;
branches;
next	1.52;

1.52
date	2004.02.07.14.32.05;	author ru;	state Exp;
branches;
next	1.51;

1.51
date	2004.02.07.13.38.47;	author ru;	state Exp;
branches;
next	1.50;

1.50
date	2004.02.07.08.10.07;	author ru;	state Exp;
branches;
next	1.49;

1.49
date	2004.02.06.21.58.31;	author ru;	state Exp;
branches;
next	1.48;

1.48
date	2004.02.06.12.58.31;	author ru;	state Exp;
branches;
next	1.47;

1.47
date	2003.06.26.03.51.57;	author peter;	state Exp;
branches;
next	1.46;

1.46
date	2003.02.25.15.41.49;	author ru;	state Exp;
branches;
next	1.45;

1.45
date	2003.01.26.13.33.57;	author phk;	state Exp;
branches;
next	1.44;

1.44
date	2002.12.21.02.03.31;	author obrien;	state Exp;
branches;
next	1.43;

1.43
date	2002.12.18.07.13.53;	author imp;	state Exp;
branches;
next	1.42;

1.42
date	2002.12.17.21.10.34;	author imp;	state Exp;
branches;
next	1.41;

1.41
date	2002.12.14.19.44.13;	author phk;	state Exp;
branches;
next	1.40;

1.40
date	2002.10.08.18.19.01;	author jhb;	state Exp;
branches
	1.40.2.1;
next	1.39;

1.39
date	2002.10.08.15.49.35;	author phk;	state Exp;
branches;
next	1.38;

1.38
date	2002.10.08.12.09.16;	author green;	state Exp;
branches;
next	1.37;

1.37
date	2002.10.08.07.52.28;	author phk;	state Exp;
branches;
next	1.36;

1.36
date	2002.10.07.22.21.16;	author green;	state Exp;
branches;
next	1.35;

1.35
date	2002.10.07.21.36.06;	author phk;	state Exp;
branches;
next	1.34;

1.34
date	2002.10.07.20.56.08;	author phk;	state Exp;
branches;
next	1.33;

1.33
date	2002.10.07.08.09.20;	author phk;	state Exp;
branches;
next	1.32;

1.32
date	2002.07.29.09.40.14;	author ru;	state Exp;
branches;
next	1.31;

1.31
date	2002.06.21.11.00.00;	author phk;	state Exp;
branches;
next	1.30;

1.30
date	2002.06.21.06.18.01;	author mckusick;	state Exp;
branches;
next	1.29;

1.29
date	2002.06.05.12.30.41;	author phk;	state Exp;
branches;
next	1.28;

1.28
date	2002.06.05.11.10.38;	author phk;	state Exp;
branches;
next	1.27;

1.27
date	2002.05.13.16.16.00;	author ru;	state Exp;
branches;
next	1.26;

1.26
date	2002.05.12.15.45.28;	author bde;	state Exp;
branches;
next	1.25;

1.25
date	2002.05.11.21.39.59;	author peter;	state Exp;
branches;
next	1.24;

1.24
date	2002.05.10.04.05.42;	author jhb;	state Exp;
branches;
next	1.23;

1.23
date	2002.05.10.00.53.45;	author obrien;	state Exp;
branches;
next	1.22;

1.22
date	2001.07.31.19.50.09;	author jhb;	state Exp;
branches;
next	1.21;

1.21
date	2001.07.21.14.32.42;	author rnordier;	state Exp;
branches;
next	1.20;

1.20
date	2000.10.02.17.23.15;	author rnordier;	state Exp;
branches;
next	1.19;

1.19
date	2000.06.26.22.57.16;	author jhb;	state Exp;
branches;
next	1.18;

1.18
date	2000.05.23.12.18.48;	author jhb;	state Exp;
branches;
next	1.17;

1.17
date	2000.04.11.14.49.13;	author jhb;	state Exp;
branches;
next	1.16;

1.16
date	99.11.15.04.23.40;	author obrien;	state Exp;
branches
	1.16.2.1;
next	1.15;

1.15
date	99.11.13.23.08.46;	author obrien;	state Exp;
branches;
next	1.14;

1.14
date	99.08.28.00.40.00;	author peter;	state Exp;
branches;
next	1.13;

1.13
date	99.07.20.01.19.23;	author rnordier;	state Exp;
branches;
next	1.12;

1.12
date	99.04.05.07.24.51;	author rnordier;	state Exp;
branches;
next	1.11;

1.11
date	99.01.10.14.48.03;	author rnordier;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	98.11.08.15.36.34;	author rnordier;	state Exp;
branches;
next	1.9;

1.9
date	98.11.05.20.52.25;	author rnordier;	state Exp;
branches;
next	1.8;

1.8
date	98.10.20.20.20.48;	author rnordier;	state Exp;
branches;
next	1.7;

1.7
date	98.10.15.22.08.13;	author rnordier;	state Exp;
branches;
next	1.6;

1.6
date	98.10.15.20.04.21;	author rnordier;	state Exp;
branches;
next	1.5;

1.5
date	98.10.14.01.53.56;	author rnordier;	state Exp;
branches;
next	1.4;

1.4
date	98.10.14.00.24.16;	author rnordier;	state Exp;
branches;
next	1.3;

1.3
date	98.10.13.21.35.42;	author rnordier;	state Exp;
branches;
next	1.2;

1.2
date	98.10.13.18.29.18;	author rnordier;	state Exp;
branches;
next	1.1;

1.1
date	98.10.12.21.16.26;	author rnordier;	state Exp;
branches
	1.1.1.1;
next	;

1.72.2.1
date	2012.11.17.01.51.17;	author svnexp;	state dead;
branches;
next	1.72.2.2;

1.72.2.2
date	2013.03.28.13.04.01;	author svnexp;	state Exp;
branches;
next	;

1.70.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.70.2.1.2.1;
next	1.70.2.2;

1.70.2.2
date	2012.03.13.18.39.57;	author dim;	state Exp;
branches
	1.70.2.2.2.1;
next	1.70.2.3;

1.70.2.3
date	2012.11.17.11.36.47;	author svnexp;	state Exp;
branches;
next	1.70.2.4;

1.70.2.4
date	2013.07.11.16.01.44;	author svnexp;	state Exp;
branches;
next	1.70.2.5;

1.70.2.5
date	2014.01.04.22.05.08;	author svnexp;	state Exp;
branches;
next	1.70.2.6;

1.70.2.6
date	2014.01.10.00.01.45;	author svnexp;	state Exp;
branches;
next	;

1.70.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.70.2.1.2.2;

1.70.2.1.2.2
date	2012.11.17.08.36.46;	author svnexp;	state Exp;
branches;
next	;

1.70.2.2.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.70.2.2.2.2;

1.70.2.2.2.2
date	2012.11.17.08.47.36;	author svnexp;	state Exp;
branches;
next	;

1.62.2.1
date	2008.01.24.19.42.16;	author jhb;	state Exp;
branches
	1.62.2.1.2.1
	1.62.2.1.4.1
	1.62.2.1.6.1
	1.62.2.1.8.1;
next	1.62.2.2;

1.62.2.2
date	2012.11.17.08.04.53;	author svnexp;	state Exp;
branches;
next	;

1.62.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.62.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.62.2.1.6.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.62.2.1.8.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.62.2.1.8.2;

1.62.2.1.8.2
date	2012.11.17.08.17.05;	author svnexp;	state Exp;
branches;
next	;

1.62.4.1
date	2008.01.24.22.23.21;	author jhb;	state Exp;
branches
	1.62.4.1.2.1;
next	1.62.4.2;

1.62.4.2
date	2012.11.17.07.42.38;	author svnexp;	state Exp;
branches;
next	;

1.62.4.1.2.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.62.6.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.62.6.1.2.1
	1.62.6.1.4.1;
next	1.62.6.2;

1.62.6.2
date	2010.10.17.20.10.00;	author pjd;	state Exp;
branches
	1.62.6.2.2.1;
next	1.62.6.3;

1.62.6.3
date	2011.03.18.17.23.23;	author jhb;	state Exp;
branches;
next	1.62.6.4;

1.62.6.4
date	2012.01.15.21.43.24;	author avg;	state Exp;
branches
	1.62.6.4.2.1;
next	1.62.6.5;

1.62.6.5
date	2012.11.17.10.36.27;	author svnexp;	state Exp;
branches;
next	1.62.6.6;

1.62.6.6
date	2014.01.04.22.23.27;	author svnexp;	state Exp;
branches;
next	;

1.62.6.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.62.6.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.62.6.2.2.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.62.6.4.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.62.6.4.2.2;

1.62.6.4.2.2
date	2012.11.17.08.25.07;	author svnexp;	state Exp;
branches;
next	;

1.56.2.1
date	2004.12.02.19.01.45;	author yar;	state Exp;
branches;
next	1.56.2.2;

1.56.2.2
date	2005.03.16.18.54.37;	author obrien;	state Exp;
branches;
next	;

1.40.2.1
date	2002.12.23.01.02.45;	author imp;	state Exp;
branches;
next	;

1.16.2.1
date	2000.04.15.03.09.40;	author ps;	state Exp;
branches;
next	1.16.2.2;

1.16.2.2
date	2000.07.06.23.04.28;	author obrien;	state Exp;
branches;
next	1.16.2.3;

1.16.2.3
date	2000.07.07.21.12.29;	author jhb;	state Exp;
branches;
next	1.16.2.4;

1.16.2.4
date	2001.08.14.22.55.29;	author jhb;	state Exp;
branches;
next	1.16.2.5;

1.16.2.5
date	2002.08.07.16.31.53;	author ru;	state Exp;
branches;
next	;

1.11.2.1
date	99.07.28.08.31.01;	author rnordier;	state Exp;
branches;
next	1.11.2.2;

1.11.2.2
date	99.08.29.16.20.43;	author peter;	state Exp;
branches;
next	;

1.1.1.1
date	98.10.12.21.16.26;	author rnordier;	state Exp;
branches;
next	;


desc
@@


1.73
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/252492
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 252492 2013-07-01 22:38:36Z wblock $

.PATH:		${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common

FILES=		gptboot
MAN=		gptboot.8

NM?=		nm

BOOT_COMCONSOLE_PORT?= 0x3f8
BOOT_COMCONSOLE_SPEED?= 9600
B2SIOFMT?=	0x3

REL1=	0x700
ORG1=	0x7c00
ORG2=	0x0

# Decide level of UFS support.
GPTBOOT_UFS?=	UFS1_AND_UFS2
#GPTBOOT_UFS?=	UFS2_ONLY
#GPTBOOT_UFS?=	UFS1_ONLY

CFLAGS=	-DBOOTPROG=\"gptboot\" \
	-O1 \
	-DGPT \
	-D${GPTBOOT_UFS} \
	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
	-DSIOFMT=${B2SIOFMT} \
	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
	-I${.CURDIR}/../../common \
	-I${.CURDIR}/../common \
	-I${.CURDIR}/../btx/lib -I. \
	-I${.CURDIR}/../boot2 \
	-I${.CURDIR}/../../.. \
	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
	-Winline --param max-inline-insns-single=100

LDFLAGS=-static -N --gc-sections

# Pick up ../Makefile.inc early.
.include <bsd.init.mk>

CLEANFILES=	gptboot

gptboot: gptldr.bin gptboot.bin ${BTXKERN}
	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
	    -o ${.TARGET} gptboot.bin

CLEANFILES+=	gptldr.bin gptldr.out gptldr.o

gptldr.bin: gptldr.out
	objcopy -S -O binary gptldr.out ${.TARGET}

gptldr.out: gptldr.o
	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o

CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
		cons.o util.o

gptboot.bin: gptboot.out
	objcopy -S -O binary gptboot.out ${.TARGET}

gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}

gptboot.o: ${.CURDIR}/../../common/ufsread.c

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend gptboot.o: machine
CLEANFILES+=	machine
machine:
	ln -sf ${.CURDIR}/../../../i386/include machine
.endif

.include <bsd.prog.mk>

# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS.gptldr.S=	${CLANG_NO_IAS}
CFLAGS+=		${CFLAGS.${.IMPSRC:T}}
@


1.72
log
@Switching exporter and resync
@
text
@d1 1
a1 1
# $FreeBSD: head/sys/boot/i386/gptboot/Makefile 232263 2012-02-28 18:30:18Z dim $
d6 1
@


1.72.2.1
log
@file Makefile was added on branch RELENG_8_4 on 2013-03-28 13:04:01 +0000
@
text
@d1 80
@


1.72.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 76
# $FreeBSD: releng/8.4/sys/boot/i386/gptboot/Makefile 230162 2012-01-15 21:43:24Z avg $

.PATH:		${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common

FILES=		gptboot

NM?=		nm

BOOT_COMCONSOLE_PORT?= 0x3f8
BOOT_COMCONSOLE_SPEED?= 9600
B2SIOFMT?=	0x3

REL1=	0x700
ORG1=	0x7c00
ORG2=	0x0

# Decide level of UFS support.
GPTBOOT_UFS?=	UFS1_AND_UFS2
#GPTBOOT_UFS?=	UFS2_ONLY
#GPTBOOT_UFS?=	UFS1_ONLY

CFLAGS=	-DBOOTPROG=\"gptboot\" \
	-O1 \
	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
	-DGPT \
	-D${GPTBOOT_UFS} \
	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
	-DSIOFMT=${B2SIOFMT} \
	-DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
	-I${.CURDIR}/../../common \
	-I${.CURDIR}/../common \
	-I${.CURDIR}/../btx/lib -I. \
	-I${.CURDIR}/../boot2 \
	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
	-Winline --param max-inline-insns-single=100

LDFLAGS=-static -N --gc-sections

# Pick up ../Makefile.inc early.
.include <bsd.init.mk>

CLEANFILES=	gptboot

gptboot: gptldr.bin gptboot.bin ${BTXKERN}
	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l gptldr.bin \
	    -o ${.TARGET} gptboot.bin

CLEANFILES+=	gptldr.bin gptldr.out gptldr.o

gptldr.bin: gptldr.out
	objcopy -S -O binary gptldr.out ${.TARGET}

gptldr.out: gptldr.o
	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o

CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
		cons.o util.o

gptboot.bin: gptboot.out
	objcopy -S -O binary gptboot.out ${.TARGET}

gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}

gptboot.o: ${.CURDIR}/../../common/ufsread.c

.if ${MACHINE_ARCH} == "amd64"
beforedepend gptboot.o: machine
CLEANFILES+=	machine
machine:
	ln -sf ${.CURDIR}/../../../i386/include machine
.endif

.include <bsd.prog.mk>
@


1.71
log
@SVN rev 232263 on 2012-02-28 18:30:18Z by dim

Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang       (disables -Werror)
- NO_WCAST_ALIGN.clang  (disables -Wcast-align)
- NO_WFORMAT.clang	(disables -Wformat and friends)
- CLANG_NO_IAS		(disables integrated assembler)
- CLANG_OPT_SMALL	(adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf!  For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp

MFC after:	2 weeks
@
text
@d1 1
a1 1
# $FreeBSD$
@


1.70
log
@SVN rev 225530 on 2011-09-13 14:03:55Z by avg

gpt/zfs boot blocks: reduce optimizing CFLAGS to -O1

gpt and zfs boot blocks are not nearly as size-constrained as boot2
from which they inherited their current optimization and anti-optimization
options.  As such the current options do not provide any benefit, but
make debugging of the code much harder.
Also, it has been demonstrated that combination of -mrtd and
-fno-unit-at-a-time may result in mis-compilation of the boot code
with the current base gcc.

Additionally, intermediate assembly file filtering is removed for
zfsboot.

The new boot blocks are all compile- and boot- tested using qemu.
gptzfsboot is tested with real hardware.

Reported by:	Peter Jeremy <peterjeremy@@acm.org> [miscompilation]
Discussed with:	bde, jhb
Tested by:	Sebastian Chmielewski <chmielsster@@gmail.com> [gptzfsboot]
Approved by:	re (kib)
MFC after:	3 weeks
@
text
@a38 5
.if ${CC:T:Mclang} == "clang"
# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS+=	${.IMPSRC:T:Mgptldr.S:C/^.+$/-no-integrated-as/}
.endif

d77 4
@


1.70.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.70.2.2
log
@SVN rev 232930 on 2012-03-13 18:39:57Z by dim

MFC r232263:

Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang       (disables -Werror)
- NO_WCAST_ALIGN.clang  (disables -Wcast-align)
- NO_WFORMAT.clang	(disables -Wformat and friends)
- CLANG_NO_IAS		(disables integrated assembler)
- CLANG_OPT_SMALL	(adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf!  For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp
@
text
@d39 5
a81 4

# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS.gptldr.S=	${CLANG_NO_IAS}
CFLAGS+=		${CFLAGS.${.IMPSRC:T}}
@


1.70.2.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/sys/boot/i386/gptboot/Makefile 232930 2012-03-13 18:39:57Z dim $
@


1.70.2.4
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/253211
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/sys/boot/i386/gptboot/Makefile 253211 2013-07-11 15:45:51Z wblock $
a5 1
MAN=		gptboot.8
@


1.70.2.5
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/260291
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/sys/boot/i386/gptboot/Makefile 260291 2014-01-04 22:00:07Z dim $
d40 1
a40 1
LD_FLAGS=-static -N --gc-sections
d57 1
a57 1
	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
d66 1
a66 1
	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
@


1.70.2.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/260497
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/sys/boot/i386/gptboot/Makefile 260497 2014-01-09 23:08:56Z dim $
d38 1
a38 3
	-Winline

CFLAGS.gcc+=	--param max-inline-insns-single=100
@


1.70.2.2.2.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.70.2.2.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.1/sys/boot/i386/gptboot/Makefile 232930 2012-03-13 18:39:57Z dim $
@


1.70.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.70.2.1.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.0/sys/boot/i386/gptboot/Makefile 225530 2011-09-13 14:03:55Z avg $
@


1.69
log
@SVN rev 219483 on 2011-03-11 13:11:15Z by jhb

Remove all object files during 'make clean'.

PR:		kern/154888
Submitted by:	arundel
MFC after:	1 week
@
text
@d23 1
a23 6
	-Os \
	-fno-guess-branch-probability \
	-fomit-frame-pointer \
	-fno-unit-at-a-time \
	-mno-align-long-strings \
	-mrtd \
@


1.68
log
@SVN rev 219079 on 2011-02-27 02:06:09Z by dim

Clang's integrated assembler can now handle sys/boot/i386/boot2/sio.S.
It used to choke on the notation "inb (%dx),%al" for "inb %dx,%al"; GNU
as accepts both forms.  Which notation is more 'correct' is an open
question. :)
@
text
@d68 2
a69 1
CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o ufsread.o
@


1.67
log
@SVN rev 218893 on 2011-02-20 19:33:47Z by dim

Upgrade our copy of llvm/clang to r126079, from upstream's trunk.

This contains many improvements, primarily better C++ support, an
integrated assembler for x86 and support for -pg.
@
text
@a46 2
# XXX: clang integrated-as doesn't grok some 16-bit instructions yet
CFLAGS+=	${.IMPSRC:T:Msio.S:C/^.+$/-no-integrated-as/}
@


1.66
log
@SVN rev 217028 on 2011-01-05 21:46:08Z by dim

Remove superfluous -mno-(mmx|3dnow|sse|sse2|sse3) flags in Makefiles
under sys/boot/{i386,pc98}, since these are already added via
sys/boot/{i386,pc98}/Makefile.inc.

Submitted by:	arundel
@
text
@d44 7
@


1.65
log
@SVN rev 213568 on 2010-10-08 10:27:52Z by pho

Ensure that a make from sys/boot does not pick up include files from
/usr/include.

Discussed with:	 kib
@
text
@a28 1
	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
@


1.64
log
@SVN rev 213136 on 2010-09-24 19:49:12Z by pjd

- Split code shared by almost any boot loader into separate files and
  clean up most layering violations:

	sys/boot/i386/common/rbx.h:

		RBX_* defines
		OPT_SET()
		OPT_CHECK()

	sys/boot/common/util.[ch]:

		memcpy()
		memset()
		memcmp()
		bcpy()
		bzero()
		bcmp()
		strcmp()
		strncmp() [new]
		strcpy()
		strcat()
		strchr()
		strlen()
		printf()

	sys/boot/i386/common/cons.[ch]:

		ioctrl
		putc()
		xputc()
		putchar()
		getc()
		xgetc()
		keyhit() [now takes number of seconds as an argument]
		getstr()

	sys/boot/i386/common/drv.[ch]:

		struct dsk
		drvread()
		drvwrite() [new]
		drvsize() [new]

	sys/boot/common/crc32.[ch] [new]

	sys/boot/common/gpt.[ch] [new]

- Teach gptboot and gptzfsboot about new files. I haven't touched the
  rest, but there is still a lot of code duplication to be removed.

- Implement full GPT support. Currently we just read primary header and
  partition table and don't care about checksums, etc. After this change we
  verify checksums of primary header and primary partition table and if
  there is a problem we fall back to backup header and backup partition
  table.

- Clean up most messages to use prefix of boot program, so in case of an
  error we know where the error comes from, eg.:

	gptboot: unable to read primary GPT header

- If we can't boot, print boot prompt only once and not every five
  seconds.

- Honour newly added GPT attributes:

	bootme - this is bootable partition
	bootonce - try to boot from this partition only once
	bootfailed - we failed to boot from this partition

- Change boot order of gptboot to the following:

	1. Try to boot from all the partitions that have both 'bootme'
	   and 'bootonce' attributes one by one.
	2. Try to boot from all the partitions that have only 'bootme'
	   attribute one by one.
	3. If there are no partitions with 'bootme' attribute, boot from
	   the first UFS partition.

- The 'bootonce' functionality is implemented in the following way:

	1. Walk through all the partitions and when 'bootonce'
	   attribute is found without 'bootme' attribute, remove
	   'bootonce' attribute and set 'bootfailed' attribute.
	   'bootonce' attribute alone means that we tried to boot from
	   this partition, but boot failed after leaving gptboot and
	   machine was restarted.
	2. Find partition with both 'bootme' and 'bootonce' attributes.
	3. Remove 'bootme' attribute.
	4. Try to execute /boot/loader or /boot/kernel/kernel from that
	   partition. If succeeded we stop here.
	5. If execution failed, remove 'bootonce' and set 'bootfailed'.
	6. Go to 2.

   If whole boot succeeded there is new /etc/rc.d/gptboot script coming
   that will log all partitions that we failed to boot from (the ones with
   'bootfailed' attribute) and will remove this attribute. It will also
   find partition with 'bootonce' attribute - this is the partition we
   booted from successfully. The script will log success and remove the
   attribute.

   All the GPT updates we do here goes to both primary and backup GPT if
   they are valid. We don't touch headers or partition tables when
   checksum doesn't match.

Reviewed by:	arch (Message-ID: <20100917234542.GE1902@@garage.freebsd.pl>)
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com
MFC after:	2 weeks
@
text
@d39 1
@


1.63
log
@SVN rev 211677 on 2010-08-23 01:42:09Z by imp

MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH
@
text
@d3 1
a3 1
.PATH:		${.CURDIR}/../boot2
d22 2
a23 1
CFLAGS=	-Os \
d30 1
d36 1
d63 1
a63 1
CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o
d68 2
a69 2
gptboot.out: ${BTXCRT} gptboot.o sio.o
	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
@


1.62
log
@Add . to the include path so that we follow the 'machine' symlink we create
during depend on amd64.

Reported by:	rwatson
@
text
@d70 1
a70 1
.if ${MACHINE_ARCH} == "amd64"
@


1.62.6.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.62.6.2
log
@SVN rev 213994 on 2010-10-17 20:10:00Z by pjd

MFC r213133,r213135,r213136,r213137,r213245:

r213133:

Add three GPT attributes:

GPT_ENT_ATTR_BOOTME - this is bootable partition

GPT_ENT_ATTR_BOOTONCE - try to boot only once from this partition

GPT_ENT_ATTR_BOOTFAILED - set this flag if we cannot boot from partition
	containing GPT_ENT_ATTR_BOOTONCE flag; note that if we cannot
	boot from partition that contains only GPT_ENT_ATTR_BOOTME flag,
	the GPT_ENT_ATTR_BOOTFAILED flag won't be set

According to wikipedia Microsoft TechNet says that attributes are divided into
two halves: the lower 4 bytes representing partition independent attributes,
and the upper 4 bytes are partition type dependent. Microsoft is already using
bits 60 (read-only), 62 (hidden) and 63 (do not automount) and I'd like to not
collide with those, so we are using bit 59 (bootme), 58 (bootonce) and 57
(bootfailed).

Reviewed by:	arch (Message-ID: <20100917234542.GE1902@@garage.freebsd.pl>)

r213135:

Allow to configure GPT attributes. It shouldn't be allowed to set bootfailed
attribute (it should be allowed only to unset it), but for test purposes it
might be useful, so the current code allows it.

Reviewed by:	arch@@ (Message-ID: <20100917234542.GE1902@@garage.freebsd.pl>)

r213136:

- Split code shared by almost any boot loader into separate files and
  clean up most layering violations:

	sys/boot/i386/common/rbx.h:

		RBX_* defines
		OPT_SET()
		OPT_CHECK()

	sys/boot/common/util.[ch]:

		memcpy()
		memset()
		memcmp()
		bcpy()
		bzero()
		bcmp()
		strcmp()
		strncmp() [new]
		strcpy()
		strcat()
		strchr()
		strlen()
		printf()

	sys/boot/i386/common/cons.[ch]:

		ioctrl
		putc()
		xputc()
		putchar()
		getc()
		xgetc()
		keyhit() [now takes number of seconds as an argument]
		getstr()

	sys/boot/i386/common/drv.[ch]:

		struct dsk
		drvread()
		drvwrite() [new]
		drvsize() [new]

	sys/boot/common/crc32.[ch] [new]

	sys/boot/common/gpt.[ch] [new]

- Teach gptboot and gptzfsboot about new files. I haven't touched the
  rest, but there is still a lot of code duplication to be removed.

- Implement full GPT support. Currently we just read primary header and
  partition table and don't care about checksums, etc. After this change we
  verify checksums of primary header and primary partition table and if
  there is a problem we fall back to backup header and backup partition
  table.

- Clean up most messages to use prefix of boot program, so in case of an
  error we know where the error comes from, eg.:

	gptboot: unable to read primary GPT header

- If we can't boot, print boot prompt only once and not every five
  seconds.

- Honour newly added GPT attributes:

	bootme - this is bootable partition
	bootonce - try to boot from this partition only once
	bootfailed - we failed to boot from this partition

- Change boot order of gptboot to the following:

	1. Try to boot from all the partitions that have both 'bootme'
	   and 'bootonce' attributes one by one.
	2. Try to boot from all the partitions that have only 'bootme'
	   attribute one by one.
	3. If there are no partitions with 'bootme' attribute, boot from
	   the first UFS partition.

- The 'bootonce' functionality is implemented in the following way:

	1. Walk through all the partitions and when 'bootonce'
	   attribute is found without 'bootme' attribute, remove
	   'bootonce' attribute and set 'bootfailed' attribute.
	   'bootonce' attribute alone means that we tried to boot from
	   this partition, but boot failed after leaving gptboot and
	   machine was restarted.
	2. Find partition with both 'bootme' and 'bootonce' attributes.
	3. Remove 'bootme' attribute.
	4. Try to execute /boot/loader or /boot/kernel/kernel from that
	   partition. If succeeded we stop here.
	5. If execution failed, remove 'bootonce' and set 'bootfailed'.
	6. Go to 2.

   If whole boot succeeded there is new /etc/rc.d/gptboot script coming
   that will log all partitions that we failed to boot from (the ones with
   'bootfailed' attribute) and will remove this attribute. It will also
   find partition with 'bootonce' attribute - this is the partition we
   booted from successfully. The script will log success and remove the
   attribute.

   All the GPT updates we do here goes to both primary and backup GPT if
   they are valid. We don't touch headers or partition tables when
   checksum doesn't match.

Reviewed by:	arch (Message-ID: <20100917234542.GE1902@@garage.freebsd.pl>)
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r213137:

Add gptboot script that is responsible for:
- looking for partition with 'bootonce' attribute alone (without 'bootme'
  attribute), removing it and logging that we successfully booted from this
  partition.
- looking for partitions with 'bootfailed' attribute, removing it and
  logging that we failed to boot from this partition.

Reviewed by:	arch (Message-ID: <20100917234542.GE1902@@garage.freebsd.pl>)
Obtained from:	Wheel Systems Sp. z o.o. http://www.wheelsystems.com

r213245:

Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.

Reviewed by:	simon, rpaulo
@
text
@d3 1
a3 1
.PATH:		${.CURDIR}/../boot2 ${.CURDIR}/../common ${.CURDIR}/../../common
d22 1
a22 2
CFLAGS=	-DBOOTPROG=\"gptboot\" \
	-Os \
a28 1
	-DGPT \
a33 1
	-I${.CURDIR}/../common \
d60 1
a60 1
CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o ufsread.o
d65 2
a66 2
gptboot.out: ${BTXCRT} gptboot.o sio.o gpt.o crc32.o drv.o cons.o util.o
	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
@


1.62.6.3
log
@SVN rev 219751 on 2011-03-18 17:23:23Z by jhb

MFC 219483: Remove all object files during 'make clean'.
@
text
@d63 1
a63 2
CLEANFILES+=	gptboot.bin gptboot.out gptboot.o sio.o gpt.o crc32.o drv.o \
		cons.o util.o
@


1.62.6.4
log
@SVN rev 230162 on 2012-01-15 21:43:24Z by avg

MFC r225530: gpt/zfs boot blocks: reduce optimizing CFLAGS to -O1
@
text
@d23 6
a28 1
	-O1 \
@


1.62.6.5
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d1 1
a1 1
# $FreeBSD: stable/8/sys/boot/i386/gptboot/Makefile 230162 2012-01-15 21:43:24Z avg $
@


1.62.6.6
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/260291
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@d1 1
a1 1
# $FreeBSD: stable/8/sys/boot/i386/gptboot/Makefile 260291 2014-01-04 22:00:07Z dim $
d39 1
a39 1
LD_FLAGS=-static -N --gc-sections
d56 1
a56 1
	${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} gptldr.o
d65 1
a65 1
	${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
@


1.62.6.4.2.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.62.6.4.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/8.3/sys/boot/i386/gptboot/Makefile 230162 2012-01-15 21:43:24Z avg $
@


1.62.6.2.2.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.62.6.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.62.6.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.62.4.1
log
@MFC: Add support for booting from GPT-labeled disks from the BIOS.  This
includes /boot/pmbr, /boot/gptboot, and 'gpt boot'.
@
text
@@


1.62.4.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: stable/6/sys/boot/i386/gptboot/Makefile 175651 2008-01-24 22:23:22Z jhb $
@


1.62.4.1.2.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.62.2.1
log
@MFC: Add support for booting from GPT-labeled disks from the BIOS.  This
includes /boot/pmbr, /boot/gptboot, and 'gpt boot'.
@
text
@@


1.62.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: stable/7/sys/boot/i386/gptboot/Makefile 175646 2008-01-24 19:42:17Z jhb $
@


1.62.2.1.8.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.62.2.1.8.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/7.4/sys/boot/i386/gptboot/Makefile 175646 2008-01-24 19:42:17Z jhb $
@


1.62.2.1.6.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.62.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.62.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.61
log
@First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot.  /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel.  Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type.  This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k.  However,
it is limited in that it can only be 545k.  That's still a lot better than
the current 7.5k limit for boot2 on MBR.  gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader.  Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
  /boot/pmbr and /boot/gptboot.  Note that the disk must have some free
  space for the boot partition.
  - This required exposing the backend of the 'add' function as a
    gpt_add_part() function to the rest of gpt(8).  'boot' uses this to
    create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
  it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
  unlike boot1 since /boot/pmbr loads all of gptboot up front.  The
  C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
  The primary changes are to parse the GPT to find a root filesystem
  and to use 64-bit disk addresses.  Currently gptboot assumes that the
  first UFS partition on the disk is the / filesystem, but this algorithm
  will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
  GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
  similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after:	1 month
Discussed with:	marcel (some things might still change, but am committing
			what I have so far)
@
text
@d34 1
a34 1
	-I${.CURDIR}/../btx/lib \
@


1.60
log
@Tweak inlining parameters a little. Add warning to tell us if function
we declared as inline can not be inlined.
@
text
@d3 3
a5 1
FILES=		boot boot1 boot2
a8 3
# A value of 0x80 enables LBA support.
BOOT_BOOT1_FLAGS?=	0x80

d15 1
a15 1
ORG2=	0x2000
d18 3
a20 3
BOOT2_UFS?=	UFS1_AND_UFS2
#BOOT2_UFS?=	UFS2_ONLY
#BOOT2_UFS?=	UFS1_ONLY
d29 1
a29 2
	-D${BOOT2_UFS} \
	-DFLAGS=${BOOT_BOOT1_FLAGS} \
d34 2
a35 1
	-I${.CURDIR}/../btx/lib -I. \
d46 1
a46 6
CLEANFILES=	boot

boot: boot1 boot2
	cat boot1 boot2 > boot

CLEANFILES+=	boot1 boot1.out boot1.o
d48 3
a50 2
boot1: boot1.out
	objcopy -S -O binary boot1.out ${.TARGET}
d52 1
a52 2
boot1.out: boot1.o
	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
d54 2
a55 2
CLEANFILES+=	boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
		boot2.s boot2.s.tmp boot2.h sio.o
d57 2
a58 4
boot2: boot2.ld
	@@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
	    echo "$$x bytes available"; test $$x -ge 0
	dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
d60 1
a60 3
boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
	btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
	    -o ${.TARGET} -P 1 boot2.bin
d62 2
a63 2
boot2.ldr:
	dd if=/dev/zero of=${.TARGET} bs=276 count=1
d65 1
a65 4
boot2.bin: boot2.out
	objcopy -S -O binary boot2.out ${.TARGET}

boot2.out: ${BTXCRT} boot2.o sio.o
d68 1
a68 15
boot2.o: boot2.s

SRCS=	boot2.c boot2.h

boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
	${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
	sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
	rm -f boot2.s.tmp

boot2.h: boot1.out
	${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
	    { x = $$1 - ORG1; \
	    printf("#define XREADORG %#x\n", REL1 + x) }' \
	    ORG1=`printf "%d" ${ORG1}` \
	    REL1=`printf "%d" ${REL1}` > ${.TARGET}
d71 1
a71 1
beforedepend boot2.s: machine
@


1.59
log
@Add -mno-sse3 for prescott/nocona
@
text
@d39 2
a40 1
	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
@


1.58
log
@Ensure GCC does not use FP registers in integer code.
I think all we really need is -fno-sse2.
I really don't like cluttering up the compiler invocation,
but this bigger hammer will fix reported problems for now.
@
text
@d29 1
a29 1
	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
@


1.57
log
@B1FLAGS -> BOOT_BOOT1_FLAGS, which is consistent with
naming of other boot-related make vars.
@
text
@d29 1
@


1.56
log
@Compile boot2 with -fno-unit-at-a-time. GCCs aggressive optimization
breaks boot in spectacular ways otherwise.
@
text
@d8 1
a8 1
B1FLAGS=	0x80
d30 1
a30 1
	-DFLAGS=${B1FLAGS} \
@


1.56.2.1
log
@MFC:	Try using packet mode by default, but provide a user
	with a knob to disable it at build time--flag 0x80 for
	BOOT_MBR_FLAGS and BOOT_BOOT1_FLAGS.  In fact, disabling
	packet mode completely, even a test for it, should be
	necessary only for old and brain-damaged machines FreeBSD 5
	will hardly run on.

	mbr/Makefile	1.14
	mbr/mbr.s	1.7
	boot2/Makefile	1.57
	boot2/boot1.S	1.30

Encouraged by:	Valentin Nechayev
@
text
@d8 1
a8 1
BOOT_BOOT1_FLAGS?=	0x80
d30 1
a30 1
	-DFLAGS=${BOOT_BOOT1_FLAGS} \
@


1.56.2.2
log
@Ensure GCC does not use FP registers in integer code.

Approved by:	re(ken)
@
text
@a28 1
	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
@


1.55
log
@Re-add sio.S, and properly deal with assembler files.

Repocopied by:	joe
@
text
@d24 3
a26 1
	-fno-guess-branch-probability -fomit-frame-pointer\
@


1.54
log
@- Factor out -nostdlib to an upper level Makefile.inc.

- Now that bsd.prog.mk deals with programs linked with -nostdlib
  better, and has a notion of an "internal" program, use PROG
  where possible.  This has a good impact on the contents of
  .depend files and causes programs to be linked with cc(1).

XXX: boot2 couldn't be converted as it's actually two programs.

Tested on:	i386, amd64
@
text
@a22 5
AFLAGS+=--defsym FLAGS=${B1FLAGS} \
	--defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
	--defsym SIOFMT=${B2SIOFMT} \
	--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED}

d28 4
a54 4

boot1.o: boot1.s
	${CPP} ${CFLAGS} ${.CURDIR}/boot1.s | \
	    ${AS} ${AFLAGS} -o ${.TARGET}
@


1.53
log
@Argh, unbreak "make depend" for AMD64.

Reported by:	kris
@
text
@d39 1
a39 1
LDFLAGS=-nostdlib -static -N --gc-sections
@


1.52
log
@- Removed -elf which is not a valid gcc(1) option anymore.
- Removed -ffreestanding; it's enforced by ../Makefile.inc.
@
text
@d99 1
a99 1
boot2.s: machine
@


1.51
log
@Generate .depend file.
@
text
@d28 1
a28 1
CFLAGS=	-elf -ffreestanding -Os -fno-builtin \
@


1.50
log
@Untangle building of AMD64 boot code.

Tested on:	amd64 (sledge)
@
text
@d84 2
@


1.49
log
@First round of cleanups to sys/boot/ makefiles:

- do not use PROG for what's not a real C program,
- use sys.mk transformation rules where possible,
- only create the "machine" symlink on AMD64,
- removed MAINTAINER lines in individual makefiles,
- added the LIBSTAND defitinion to <bsd.libnames.mk>,
- somewhat better contents in .depend files.

Tested on:	i386, amd64
Prodded by:	bde
@
text
@d96 1
a96 1
.if defined(REALLY_AMD64)
d98 1
a98 1

a100 2

CLEANFILES+=	machine
@


1.48
log
@Inherit BINDIR from a parent Makefile.inc.
@
text
@d3 1
a3 7
PROG=		boot2
NOMAN=
STRIP=
BINMODE=	444
CLEANFILES=	boot boot1 boot1.out boot1.o \
		boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
		boot2.s sio.o
a13 6
.if exists(${.OBJDIR}/../btx)
BTX=	${.OBJDIR}/../btx
.else
BTX=	${.CURDIR}/../btx
.endif

d18 4
a21 1
# Decide Level of UFS support.  UFS1_AND_UFS2 doesn't fit.
d23 4
a26 3
# BOOT2_UFS?=	UFS2_ONLY
BOOT2_UFS?=	UFS1_AND_UFS2
# BOOT2_UFS?=	UFS1_ONLY
d41 4
a44 1
all: boot1 boot2 boot
d49 2
d58 2
a59 2
	${CPP} ${CFLAGS} ${.IMPSRC} | \
	    ${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} -o ${.TARGET}
d61 2
a62 5
boot2.o: boot2.c ${.CURDIR}/../../common/ufsread.c
	${CC} ${CFLAGS} -S -o boot2.s.tmp ${.IMPSRC}
	sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
	rm -f boot2.s.tmp
	${AS} ${AFLAGS} -o boot2.o boot2.s
d64 8
a71 13
boot2.h: boot1.out
	${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
	 	{ x = $$1 - ORG1; \
		printf("#define XREADORG %#x\n", REL1 + x) }' \
	 	ORG1=`printf "%d" ${ORG1}` \
		REL1=`printf "%d" ${REL1}` > boot2.h

boot2: boot2.ldr boot2.bin ${BTX}/btx/btx
	btxld -v -E ${ORG2} -f bin -b ${BTX}/btx/btx -l boot2.ldr \
		-o boot2.ld -P 1 boot2.bin
	@@ls -l boot2.ld | awk '{ x = 7680 - $$5; \
		print x " bytes available"; if (x < 0) exit 1 }'
	dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync 2>/dev/null
d74 1
a74 1
	dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null
d79 2
a80 19
boot2.out: boot2.o sio.o
	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} \
		${BTX}/lib/crt0.o ${.ALLSRC}

boot2.o: boot2.h

sio.o: sio.s
	${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
		--defsym SIOFMT=${B2SIOFMT} \
		--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
		${.IMPSRC} -o ${.TARGET}

install:
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
		boot ${DESTDIR}${BINDIR}/boot
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
		boot1 ${DESTDIR}${BINDIR}/boot1
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
		boot2 ${DESTDIR}${BINDIR}/boot2
d82 13
a94 1
.include <bsd.prog.mk>
d97 1
a97 3
boot2.o: machine

beforedepend ${OBJS}: machine
d105 1
@


1.47
log
@Build on amd64.  Yes, I know this isn't particularly nice.
@
text
@a5 1
BINDIR?=	/boot
@


1.46
log
@Fixed CLEANFILES.

Submitted by:	cron
@
text
@d112 12
@


1.45
log
@Build a file "boot" which consists of boot1 and boot2 concatenated.

There is little if any reason to treat the two components separately
and it will simplify disklabel(8) and libdisk if we didn't.
@
text
@d8 1
a8 1
CLEANFILES+=	boot1 boot1.out boot1.o \
@


1.44
log
@-mno-align-long-strings can make things smaller, so lets use it in hopes
that it does here.
@
text
@d50 4
a53 1
all: boot1 boot2
d104 2
@


1.43
log
@I didn't intend to delete this rm from the Makefile.  It snuck in at
the last second before the commit.

# likely we can remove this hack now that gcc generates better aligned code
# in the align to word case.

Noticed by: bde
@
text
@d39 1
@


1.42
log
@Make both UFS1 and UFS2 fit on the same boot blocks.  These are a
subset of Peter's patchs that are believed to be safe.

Makefile tweaks:
o -fomit-frame-pointer
o Change default to building both UFS1 and UFS2 bootblocks.

Lots of boot2 tweaks:
o lookup is only ever called with kname, so use it directly.
o inline memsize
o getstr are only ever called with cmd, so hardware that.
o tweaks to the parsing code to test after the conversion rather than
  before since we tested after anyways.
o eliminate support for %x in printf.
o eliminate a few bytes in printfs.
o Tweak the boot banner.
o eliminate support for wd and "  " devices (I might add wd back to
  keep bde happy).
o eliminate support for a few arguments.

This takes us from -162 bytes free to 67 bytes free.

I've tested this only on a few systems, so be careful when updating to
this change.

Submitted by: peter, imp, ian
@
text
@d64 1
@


1.41
log
@Employ the unused bytes after the disklabel in the second sector.  This makes
it possible to make UFS1_ONLY and UFS2_ONLY versions which fit inside the
traditional 16 sectors.

Remove assorted now unneeded hackery.

UFS1_AND_UFS2 still needs another 150 bytes to work, and that is probably
not within our reach, ever.
@
text
@d34 2
a35 2
# BOOT2_UFS?=	UFS1_AND_UFS2
BOOT2_UFS?=	UFS1_ONLY
d38 1
a38 1
	-fno-guess-branch-probability \
d47 1
a47 1
LDFLAGS=-nostdlib -static -N
a63 1
	rm -f boot2.s.tmp
@


1.40
log
@Revert MEM_USR back to 0xa000 for BTX clients.  Instead, adjust boot2
to run at 0xc000 by changing its virtual start address from 0x1000 to
0x2000.

Tested by:	phk
@
text
@d31 4
a34 2
# Setting this to anything else gives UFS1+2 support and larger
# boot2 binary.
d40 1
a46 6
.if ${BOOT2_UFS} == "UFS1_ONLY"
CFLAGS+= -D${BOOT2_UFS}
.else
# nothing here
.endif

a76 1
.if ${BOOT2_UFS} == "UFS1_ONLY"
a79 5
.else
	@@ls -l boot2.ld | awk '{ x = 9728 - $$5; \
		print x " bytes available"; if (x < 0) exit 1 }'
	dd if=boot2.ld of=${.TARGET} obs=9728 conv=osync 2>/dev/null
.endif
d82 1
a82 1
	dd if=/dev/zero of=${.TARGET} bs=512 count=1 2>/dev/null
@


1.40.2.1
log
@MFC: All the changes to the boot blocks that allow UFS1 and UFS2 to
fit into 8k.

Requested by: re (scottl)
@
text
@d31 3
a33 5
# Decide Level of UFS support.  UFS1_AND_UFS2 doesn't fit.

# BOOT2_UFS?=	UFS2_ONLY
BOOT2_UFS?=	UFS1_AND_UFS2
# BOOT2_UFS?=	UFS1_ONLY
d36 1
a36 2
	-fno-guess-branch-probability -fomit-frame-pointer\
	-mno-align-long-strings \
a37 1
	-D${BOOT2_UFS} \
d44 7
a50 1
LDFLAGS=-nostdlib -static -N --gc-sections
d80 1
d84 5
d91 1
a91 1
	dd if=/dev/zero of=${.TARGET} bs=276 count=1 2>/dev/null
@


1.39
log
@Now that ufsread.c doesn't do 64bit divide remainder operations,
don't bother with libkern.

Sponsored by:	DARPA & NAI Labs.
@
text
@d29 1
a29 1
ORG2=	0x1000
@


1.38
log
@Reinstate rev 1.36 with an important line that got missed.  Note this
also improves the "random undocumented offsets into various memory
spaces" a little bit.
@
text
@d10 1
a10 1
		boot2.s sio.o divdi3.o moddi3.o qdivrem.o
d47 1
a47 1

a95 1
.if ${BOOT2_UFS} == "UFS1_ONLY"
a96 3
.else
boot2.out: boot2.o sio.o divdi3.o moddi3.o qdivrem.o
.endif
a106 9

moddi3.o: ${.CURDIR}/../../../libkern/moddi3.c
	${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}

divdi3.o: ${.CURDIR}/../../../libkern/divdi3.c
	${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}

qdivrem.o: ${.CURDIR}/../../../libkern/qdivrem.c
	${CC} ${CFLAGS} -I${.CURDIR}/../../../ -c ${.IMPSRC}
@


1.37
log
@Unbreak boot2 by backing out rev 1.36 to Makefile, which does not
work as advertised:

	bang# pwd
	/bang/src/sys/boot/i386/boot2
	bang# make clean >& /dev/null
	bang# cvs -q update -r 1.35 Makefile >& /dev/null
	bang# make >& /dev/null
	bang# cat /usr/obj/`pwd`/boot2.h
	#define XREADORG 0x725
	bang# cvs -q update -r 1.36 Makefile > & /dev/null
	bang# make clean > & /dev/null
	bang# make > & /dev/null
	bang# cat /usr/obj/`pwd`/boot2.h
	#define XREADORG 0x25
	bang#
@
text
@d27 1
d72 4
a75 2
	 	{ x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \
	 	ORG1=`printf "%d" ${ORG1}` > boot2.h
@


1.36
log
@Correct a bug in adding 0x700 to a number.
@
text
@a26 1
REL1=	0x700
d71 1
a71 2
	 	{ x = $$1 - ORG1; \
		printf("#define XREADORG %#x\n", REL1 + x) }' \
@


1.35
log
@Conditionalize the number of sectors loaded by boot1.s on UFS1/UFS12.

Conditionalize the "XX bytes left" checks reference on UFS1/UFS12.

Conditionally build the necessary 64bit math for boot2 if UFS12.

Sponsored by:	DARPA & NAI Labs.
@
text
@d27 1
d72 2
a73 1
	 	{ x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \
@


1.34
log
@Change the comment character from # to // in boot1.s and run
it through CPP so we can conditionalized things.

Sponsored by:	DARPA & NAI Labs
@
text
@d10 1
a10 1
		boot2.s sio.o
d30 4
d43 5
a47 1
CFLAGS+= -DUFS1_ONLY 
d77 1
d81 5
d93 1
d95 3
d99 1
a99 1
		${BTX}/lib/crt0.o boot2.o sio.o
d108 9
@


1.33
log
@Move the definition of UFS1_ONLY into the Makefiles where it belongs.

Sponsored by:	DARPA & NAI Labs.
@
text
@d52 2
a53 1
	${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET}
@


1.32
log
@Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by:	bde
@
text
@d39 2
@


1.31
log
@Revert the part of Kirks UFS2 commit which added divdi3.c and moddi3.c
to libi386, this issue was resolved already in a cleaner way.
@
text
@d89 1
a89 1
	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
d91 1
a91 1
	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
@


1.30
log
@This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by:	Poul-Henning Kamp <phk@@freebsd.org>
@
text
@d78 1
a78 1
		${BTX}/lib/crt0.o boot2.o sio.o ../libi386/libi386.a
@


1.29
log
@Add explicit dependency on ufsread.c
@
text
@d78 1
a78 1
		${BTX}/lib/crt0.o boot2.o sio.o
@


1.28
log
@Preparation for UFS2 commit:

Factor the ufs reading code out of the i386/boot2 loader so it can
be reused by for instance sparc64.

Sponsored by: DARPA and NAI Labs.
@
text
@d52 1
a52 1
boot2.o: boot2.c
@


1.27
log
@Align CLEANFILES with revision 1.25 changes.
@
text
@d33 1
@


1.26
log
@Saved 176 bytes by compiling with -fno-guess-branch-probability.  The
default of -fguess-branch-probablility causes time optimizations (?)
like rewriting `if (foo) x++;' as
`if (!foo) goto forth; back: ; ...; forth: x++; goto back;".  This is
pessimizes space especially well on i386's because one short branch
gets converted to 2 long ones.

Removed -fno-align-foo since it is implied by -Os.  Previous commit
messages seem to have overstated the new alignment bugs in gcc.  The
only case that affects boot2 is that -fno-align-functions (or
equivalently -falign-functions=1) actually gives -falign-functions=2.
This is caused by FUNCTION_BOUNDARY being 2 (bytes) instead of 1.
The default case where the optimization level is 1 and no alignment
options are given is more broken.  All alignments are minimal, modulo
the bug in FUNCTION_BOUNDARY.  This is caused by toplev.c setting
defaults too early.

Some hacks in previous commits ar not needed now, but may as well be
kept until gcc is fixed.  The previous on in the Makefile saved 96
bytes of text due to the wrong FUNCTION_BOUNDARY and 32 bytes of data
due to unrelated bloat in the alignment of large objects.  There aren't
even any options to control alignment of data.
@
text
@d10 1
a10 1
		sio.o
@


1.25
log
@Use a crowbar and duct-tape to make boot2 fit again.  This gets it down
to 4 bytes free.  I removed a printf (the Keyboard yes/no) since it is of
marginal value and sed'ed the generated asm output to remove the unwanted
aligns.  There's probably a better way to gain a few extra bytes than
losing the printf.  Shortening strings is probably a better option but this
should get us over the hurdle.
@
text
@d31 1
a31 1
	-fno-align-functions -fno-align-jumps -fno-align-loops -fno-align-labels \
@


1.24
log
@- Axe -mpreferred-stack-boundary=2 as -Os turns this on by default.
- Axe -fdata-sections as turning it on or off makes no difference.  If
  it did make a difference it would serve to bloat boot2 even further with
  extra padding.
- Axe -fforce-addr.  This gets us 32 bytes so we are down to only being
  64-bytes over.

We still can't compile this with gcc 3.1.  The problem seems to be that
the -fno-align-foo options don't actually work.  Comparing the new and
old output it turns out that gcc is 4-byte padding all the functions and
labels and what not despite the passed in arguments thus adding the
unfortunate bloat to boot2.
@
text
@d51 6
@


1.23
log
@-ffreestanding is the word for /sys.
@
text
@d30 1
a30 1
CFLAGS=	-elf -ffreestanding -Os -fno-builtin -fforce-addr -fdata-sections \
d32 1
a32 1
	-mrtd -mpreferred-stack-boundary=2 \
@


1.22
log
@Add in a hack to support IBM "El Torito" CD-ROM booting BIOS's which expect
the first sector of the emulated floppy to contain a valid MS-DOS BPB that
it can modify.  Since boot1 is the first sector of boot.flp, this resulted
in the BIOS overwriting part of boot1: specifically the function used to
read in sectors from the disk.

Submitted by:	Mark Peek <mark@@whistle.com>
Submitted by:	Doug Ambrisko <ambrisko@@ambrisko.com>
PR:		i386/26382
Obtained from:	NetBSD, OpenBSD (the example BPB)
MFC after:	1 month
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.21 2001/07/21 14:32:42 rnordier Exp $
d30 4
a33 4
CFLAGS=	-elf -I${.CURDIR}/../btx/lib -I. \
	-Os -fno-builtin -fforce-addr -fdata-sections \
	-malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \
	-mpreferred-stack-boundary=2 \
@


1.21
log
@Unset MAINTAINER.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.20 2000/10/02 17:23:15 rnordier Exp $
d9 1
a9 1
		boot2.ldr boot2.bin boot2.ld boot2.out boot2.o \
d12 2
d51 5
d72 2
@


1.20
log
@Set MAINTAINER.
@
text
@d1 1
a1 3
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.19 2000/06/26 22:57:16 jhb Exp $

MAINTAINER=	rnordier
@


1.19
log
@Add in support for EDD to support large disks via LBA.  This uses a
method similar to that of the loader to avoid potentially breaking older
drives in that we only use EDD if the desired cylinder is > 1023.
@
text
@d1 3
a3 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.18 2000/05/23 12:18:48 jhb Exp $
@


1.18
log
@Clean up all of the 16-bit assembly code in the x86 bootstrap to work
with the new binutils.  Now that we have a decent assembler, all the old
m4 macros are no longer needed.  Instead, straight assembly can be used
since as(1) now understands 16-bit addressing, branches, etc.  Also,
several bugs have been fixed in as(1), allowing boot0.s to be further
cleaned up.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.17 2000/04/11 14:49:13 jhb Exp $
d13 1
a13 1
B1FLAGS=	0
@


1.17
log
@Add a missing dependency: boot2 depends on the BTX kernel.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16 1999/11/15 04:23:40 obrien Exp $
a11 2
M4?=	m4

d46 2
a47 3
boot1.o: boot1.m4 boot1.s
	(cd ${.CURDIR}; ${M4} -DFLAGS=${B1FLAGS} boot1.m4 boot1.s) | \
		${AS} ${AFLAGS} -o ${.TARGET}
d67 4
a70 4
	(cd ${.CURDIR}; ${M4} -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
		-DSIOFMT=${B2SIOFMT} \
		-DSIOSPD=${BOOT_COMCONSOLE_SPEED} sio.s) | \
		${AS} ${AFLAGS} -o ${.TARGET}
@


1.16
log
@Add -fdata-sections, which is a new GCC 2.95 optimization.  Remove
-fschedule-insns as it wasn't such a big win with 2.95 after all.

Add the *BIG* win "-mpreferred-stack-boundary=2" optimiztion submitted by
Dima.  GCC 2.95 ensures the stack frame is always properly [opitimally]
aligned by surrounding every function call by code simular to
"addl $-12, %esp" / "addl $12, %esp".  Here we need the reduction in space,
with speed not an issue.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.15 1999/11/13 23:08:46 obrien Exp $
d52 1
a52 1
boot2: boot2.ldr boot2.bin
@


1.16.2.1
log
@MFC: sync up loader with current, including PXE.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16 1999/11/15 04:23:40 obrien Exp $
d52 1
a52 1
boot2: boot2.ldr boot2.bin ${BTX}/btx/btx
@


1.16.2.2
log
@MFC:  clean up all of the 16-bit assembly code in the x86 bootstrap to work
      with Binutils 2.10.0 -- all the old m4 macros are no longer needed.

Also MFC rev 1.18-22 sys/boot/i386/btx/btx/btx.s (change string and support
                     new instructions).
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.1 2000/04/15 03:09:40 ps Exp $
d12 2
d48 3
a50 2
boot1.o: boot1.s
	${AS} ${AFLAGS} --defsym FLAGS=${B1FLAGS} ${.IMPSRC} -o ${.TARGET}
d70 4
a73 4
	${AS} ${AFLAGS} --defsym SIOPRT=${BOOT_COMCONSOLE_PORT} \
		--defsym SIOFMT=${B2SIOFMT} \
		--defsym SIOSPD=${BOOT_COMCONSOLE_SPEED} \
		${.IMPSRC} -o ${.TARGET}
@


1.16.2.3
log
@MFC: Lots of bootstrap fixes and features:

- Add $FreeBSD$ to README
- Coment fix for the if_wx module in loader.conf
- Axe all the unneeded m4 files (yay!)
- EDD support in mbr, boot1 and boot2, and the loader
- inline functions in boot2 that are only used once to gain 68 bytes of
  free space
- emulate the WBINVD instruction in BTX
- remove cruft from the cdldr Makefile
- improve hard disk probe checking as well as lsdev enhancements in the
  loader
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.2 2000/07/06 23:04:28 obrien Exp $
d13 1
a13 1
B1FLAGS=	0x80
@


1.16.2.4
log
@MFC: Hack to support CD booting on brain damaged IBM BIOSs.

Tested by:	users on -stable
Approved by:	re
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.16.2.3 2000/07/07 21:12:29 jhb Exp $
d9 1
a9 1
		boot2.ldr boot2.bin boot2.ld boot2.out boot2.o boot2.h \
a11 2
NM?=		nm

a48 5
boot2.h: boot1.out
	${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
	 	{ x = $$1 - ORG1; printf("#define XREADORG 0x7%x\n", x) }' \
	 	ORG1=`printf "%d" ${ORG1}` > boot2.h

a64 2

boot2.o: boot2.h
@


1.16.2.5
log
@MFC: Drop support for COPY.
@
text
@d1 1
a1 1
# $FreeBSD$
d82 1
a82 1
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
d84 1
a84 1
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
@


1.15
log
@Turn on the -fforce-addr and -fschedule-insns optimizations.  Adding
either one gives us an additional 32 bytes of additional space available
when using EGCS 1.1.2.  With GCC 2.95.2 -fforce-addr gives us 12 more bytes,
and adding -fschedule-insns gives us an additional 4 bytes.
@
text
@d1 1
a1 1
# $FreeBSD: src/sys/boot/i386/boot2/Makefile,v 1.14 1999/08/28 00:40:00 peter Exp $
d31 1
a31 1
	-Os -fno-builtin -fforce-addr -fschedule-insns \
d33 1
@


1.14
log
@$Id$ -> $FreeBSD$
@
text
@d1 1
a1 1
# $FreeBSD$
d30 3
a32 2
CFLAGS=	-elf -I${.CURDIR}/../btx/lib -I. -fno-builtin \
	-Os -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \
@


1.13
log
@Reintroduce LBA (cyl > 1023) support in the bootblocks, enabled by
means of a build option.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.12 1999/04/05 07:24:51 rnordier Exp $
@


1.12
log
@Optimize better for space.
Thanks to: jdp
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.11 1999/01/10 14:48:03 rnordier Exp $
d14 3
d47 1
a47 1
	(cd ${.CURDIR}; ${M4} boot1.m4 boot1.s) | \
@


1.11
log
@Use etc/make.conf settings for serial port and speed.

Submitted by: rvb
Reviewed by: bde
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.10 1998/11/08 15:36:34 rnordier Exp $
d28 1
a28 1
	-O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mrtd \
@


1.11.2.1
log
@MFC: LBA access as build option.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.11 1999/01/10 14:48:03 rnordier Exp $
a13 3
# A value of 0x80 enables LBA support.
B1FLAGS=	0

d44 1
a44 1
	(cd ${.CURDIR}; ${M4} -DFLAGS=${B1FLAGS} boot1.m4 boot1.s) | \
@


1.11.2.2
log
@$Id$ -> $FreeBSD$
@
text
@d1 1
a1 1
# $FreeBSD$
@


1.10
log
@boot1: Eliminate EDD detection and optional use of disk packet
interface.  Do some general consistency fixes and space optimizations.
Use of some freed-up space to defend against possible BIOS misfeatures.

boot2: Revise disk read interface to provide for boot1 changes.  Free
up space for this.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.9 1998/11/05 20:52:25 rnordier Exp $
d14 2
a15 1
B2SIOPRT?=	0x3f8
a16 1
B2SIODIV?=	0xc
d65 3
a67 2
	(cd ${.CURDIR}; ${M4} -DSIOPRT=${B2SIOPRT} \
		-DSIOFMT=${B2SIOFMT} -DSIODIV=${B2SIODIV} sio.s) | \
@


1.9
log
@Make use of BIOS int 0x13 extensions configurable, and disabled
by default.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.8 1998/10/20 20:20:48 rnordier Exp $
a13 1
B1INT13X?=	0
d44 1
a44 1
	(cd ${.CURDIR}; ${M4} -DFLAGS=${B1INT13X} boot1.m4 boot1.s) | \
@


1.8
log
@Make serial port, data format, and bps configurable.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.7 1998/10/15 22:08:13 rnordier Exp $
d14 1
d45 1
a45 1
	(cd ${.CURDIR}; ${M4} boot1.m4 boot1.s) | \
@


1.7
log
@Fix path to sio.s
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.6 1998/10/15 20:04:21 rnordier Exp $
d14 4
d65 3
a67 1
	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
@


1.6
log
@Add serial, dual, and probe-keyboard support.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.5 1998/10/14 01:53:56 rnordier Exp $
d61 1
a61 1
	${AS} ${AFLAGS} -o ${.TARGET} sio.s
@


1.5
log
@Fix btx include path.
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.4 1998/10/14 00:24:16 rnordier Exp $
d9 2
a10 1
		boot2.ldr boot2.bin boot2.ld boot2.out boot2.o
d56 1
a56 1
boot2.out: boot2.o
d58 4
a61 1
		${BTX}/lib/crt0.o boot2.o
@


1.4
log
@Include <bsd.prog.mk>.  Add install target (to /boot for now).
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.3 1998/10/13 21:35:42 rnordier Exp $
d22 1
a22 1
CFLAGS=	-elf -I${BTX}/lib -I. -fno-builtin \
@


1.3
log
@Change to a 15-sector boot2.
Refine slice-handling.
@
text
@d1 9
a9 1
#	$Id: Makefile,v 1.2 1998/10/13 18:29:18 rnordier Exp $
d39 2
a40 1
	${M4} boot1.m4 boot1.s | ${AS} ${AFLAGS} -o ${.TARGET}
d59 7
a65 3
clean:
	rm -f boot1 boot1.out boot1.o boot2 boot2.ldr boot2.bin \
		boot2.ld boot2.out boot2.o
@


1.2
log
@Don't use an absolute path to objcopy.
Noticed by: Scott Mace <smace@@intt.org>
@
text
@d1 1
a1 1
#	$Id: Makefile,v 1.1.1.1 1998/10/12 21:16:26 rnordier Exp $
d35 4
a38 3
		-o ${.TARGET} -P 1 boot2.bin
	@@ls -l boot2 | awk '{ x = 7680 - $$5; print x " bytes free"; \
		if (x < 0) exit 1 }'
d52 1
a52 1
		boot2.out boot2.o
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
#	$Id:$
d25 1
a25 1
	/usr/libexec/elf/objcopy -S -O binary boot1.out ${.TARGET}
d43 1
a43 1
	/usr/libexec/elf/objcopy -S -O binary boot2.out ${.TARGET}
@


1.1.1.1
log
@New boot blocks: support for /boot/loader; a.out & ELF; cyl > 1023;
multiple 0xa5 slices; etc.
@
text
@@
