  In this paper, we present a construction of linear codes over $\f_{2^t}$ from
Boolean functions, which is a generalization of Ding's method \cite[Theorem
9]{Ding15}. Based on this construction, we give two classes of linear codes
$\tilde{\C}_{f}$ and $\C_f$ (see Theorem \ref{thm-maincode1} and Theorem
\ref{thm-maincodenew}) over $\f_{2^t}$ from a Boolean function
$f:\f_{q}\rightarrow \f_2$, where $q=2^n$ and $\f_{2^t}$ is some subfield of
$\f_{q}$. The complete weight enumerator of $\tilde{\C}_{f}$ can be easily
determined from the Walsh spectrum of $f$, while the weight distribution of the
code $\C_f$ can also be easily settled. Particularly, the number of nonzero
weights of $\tilde{\C}_{f}$ and $\C_f$ is the same as the number of distinct
Walsh values of $f$. As applications of this construction, we show several
series of linear codes over $\f_{2^t}$ with two or three weights by using bent,
semibent, monomial and quadratic Boolean function $f$.
