Preheat oven to 400 degrees. Grease 1 qt casserole dish.
Sweat onions in a little butter in a saute pan until transparent.
Layer potatoes and onions in the casserole.
In a saucepan, melt butter over low heat. Mix in the flour and salt, stir constantly with a whisk for 1 minute. Stir in milk slowly and cook until mixture thickens. Stir in cheese and stir until melted. Pour cheese over the potatoes. Cover dish with aluminum foil.