The chemical reactions and pathways resulting in the formation of a glycosylphosphatidylinositol (GPI) anchor that attaches some membrane proteins to the lipid bilayer of the cell membrane. The phosphatidylinositol group is linked via the C-6 hydroxyl residue of inositol to a carbohydrate chain which is itself linked to the protein via an ethanolamine phosphate group, its amino group forming an amide linkage with the C-terminal carboxyl of the protein. Some GPI anchors have variants on this canonical linkage.