  Linear codes with a few weights can be applied to communication, consumer
electronics and data storage system. In addition, the weight hierarchy of
linear codes has many applications such as on the type II wire-tap channel,
dealing with $t$-resilient functions and trellis or branch complexity of linear
codes and so on. In this paper, we first present a formula for computing the
weight hierarchies of linear codes constructed by the generalized method of
defining sets. Then, we construct two classes of binary linear codes with a few
weights and determine their weight distributions and weight hierarchies
completely. Some codes of them can be used in secret sharing schemes.
