<PAGE>

                                                                    EXHIBIT 10.4

                           SECOND AMENDMENT AGREEMENT

                  This SECOND AMENDMENT AGREEMENT (this "Amendment") is entered
into as of August 19, 2002 among SOLECTRON CORPORATION, a Delaware corporation
(the "Company"), the several financial institutions party to the Credit
Agreement referred to below (each a "Lender" and, collectively, the "Lenders"),
GOLDMAN SACHS CREDIT PARTNERS L.P., as Sole Lead Arranger, Sole Book Runner and
Co-Syndication Agent ("Lead Arranger"), and BANK OF AMERICA, N.A., as
Administrative Agent.

                  The Company, the Lenders, Lead Arranger and the Administrative
Agent entered into a Credit Agreement dated as of February 14, 2002, as amended
by the Amendment Agreement dated as of June 18, 2002 (as in effect as of the
date of this Amendment, the "Credit Agreement").

                  The Company has requested that the Lenders agree to certain
amendments to the Credit Agreement, and the Lenders have agreed to such request,
subject to the terms and conditions of this Amendment.

                  In consideration of the mutual covenants and agreements herein
contained, the parties hereto covenant and agree as follows:

1.       Definitions; References; Interpretation.

         (a)      Unless otherwise specifically defined herein, each term used
herein (including in the Recitals hereof and in the Consent and Agreement
attached hereto as Exhibit A) which is defined in the Credit Agreement shall
have the meaning assigned to such term in the Credit Agreement.

         (b)      As used herein, "Amendment Documents" means this Amendment,
the Consent and Agreement related hereto and the Credit Agreement (as amended by
the Amendment Agreement dated as of June 18, 2002 and by this Amendment).

         (c)      Each reference to "this Agreement", "hereof", "hereunder",
"herein" and "hereby" and each other similar reference contained in the Credit
Agreement, and each reference to "the Credit Agreement" and each other similar
reference in the other Loan Documents, shall from and after the Effective Date
refer to the Credit Agreement as amended hereby.

         (d)      The rules of interpretation set forth in Sections 1.02, 1.03
and 1.05 of the Credit Agreement shall be applicable to this Amendment.

2.       Amendments to Credit Agreement. Subject to the terms and conditions
hereof, effective as of the date of satisfaction of the conditions set forth in
Section 4 (the "Effective Date") the Credit Agreement is amended as follows as
of August 28, 2002:

         (a)      Amendments to Article I of the Credit Agreement.

                                             Second Amendment Agreement (3-Year)

                                       1.

<PAGE>

                  (1)      The definition of "Cash Interest Coverage Ratio" is
amended in its entirety as follows:

                           "`Cash Interest Coverage Ratio' means, as of any date
                           of determination, the ratio of:

                                    (x) the sum of (i) Consolidated EBITDA for
                           the period of the four prior fiscal quarters ending
                           on such date, (ii) the Non-Cash Restructuring Charges
                           deducted in calculating Consolidated Net Income for
                           such period, (iii) the Goodwill Impairment Charges
                           deducted in calculating Consolidated Net Income for
                           such period; and (iv) the Cash Restructuring Charges
                           deducted in calculating Consolidated Net Income for
                           such period; provided that, the cumulative aggregate
                           amount of Cash Restructuring Charges taken in fiscal
                           quarters ending on or after May 31, 2002 but on or
                           prior to August 29, 2003 and which are included in
                           calculating the Cash Interest Coverage Ratio shall
                           not exceed $235,000,000, to

                                    (y) Consolidated Cash Interest Charges
                           during such period."

                  (2)      A new definition of "Goodwill Impairment Charges" as
set forth below shall be inserted immediately following the definition of
"GAAP":

                           "`Goodwill Impairment Charges' means, in respect of
                           any period, any goodwill impairment charges taken by
                           the Borrower and its Subsidiaries on a consolidated
                           basis during such period in accordance with GAAP."

                  (3)      The definition of "Consolidated Tangible Net Worth"
is amended in its entirety as follows:

                           "'Consolidated Tangible Net Worth' means, as of any
                           date of determination, for the Borrower and its
                           Subsidiaries on a consolidated basis, Shareholders'
                           Equity of the Borrower and its Subsidiaries on that
                           date minus the Intangible Assets of the Borrower and
                           its Subsidiaries on that date; provided that, to the
                           extent any Goodwill Impairment Charge results in any
                           upward adjustment of Shareholders' Equity of the
                           Borrower and its Subsidiaries, then such adjustment
                           shall be excluded from the calculation of
                           Consolidated Tangible Net Worth as of such date of
                           determination for purposes of testing the Borrower's
                           compliance with Section 7.13(a) (the intent of the
                           parties being that the effect of any such Goodwill
                           Impairment Charge and any related adjustment effected
                           as part of the calculation of Consolidated Tangible
                           Net Worth for the purposes of testing the Borrower's
                           compliance with Section 7.13(a) be neutral)."

         (b)      Amendment to Exhibit C of the Credit Agreement. Exhibit C of
the Credit Agreement is replaced in its entirety by Exhibit B attached to this
Amendment.

                                             Second Amendment Agreement (3-Year)

                                       2.

<PAGE>

3.       Representations and Warranties. The Company hereby represents and
warrants to the Administrative Agent, the Lead Arranger and the Lenders as
follows:

         (a)      After giving effect to the amendments set forth in Section 2,
no Default or Event of Default has occurred and is continuing (or would result
from the amendment of the Credit Agreement contemplated hereby).

         (b)      The execution, delivery and performance by the Company of the
Amendment Documents have been duly authorized by all necessary corporate and
other action and do not and will not require any registration with, consent or
approval of, or notice to or action by, any Person (including any Governmental
Authority) in order to be effective and enforceable.

         (c)      The Amendment Documents constitute the legal, valid and
binding obligations of the Company, enforceable against it in accordance with
their respective terms, except to the extent that the enforceability thereof may
be limited by applicable bankruptcy, insolvency, moratorium, reorganization and
other laws affecting creditors' rights generally and by equitable principles
(regardless of whether enforcement is sought in equity or at law).

         (d)      All representations and warranties of the Company contained in
the Credit Agreement are true and correct in all material respects (except to
the extent such representations and warranties expressly refer to an earlier
date, in which case they shall be true and correct as of such earlier date and
except that this subsection (d) shall be deemed instead to refer to the last day
of the most recent fiscal quarter and fiscal year for which financial statements
have then been delivered in respect of the representations and warranties made
in subsections 5.05(a) and (b) of the Credit Agreement.

         (e)      The Company is entering into this Amendment on the basis of
its own investigation and for its own reasons, without reliance upon the
Administrative Agent, the Lead Arranger and the Lenders or any other Person.

         (f)      The Company's obligations under the Credit Agreement and under
the other Loan Documents are not subject to any defense, counterclaim, set-off,
right of recoupment, abatement or other claim.

         (g)      The resolutions of the Board of Directors of the Company
adopted on January 23, 2002 in connection with the Credit Agreement remain
unchanged and in full force and effect, and such resolutions have not been
withdrawn or rescinded.

4.       Conditions of Effectiveness.

         (a)      The effectiveness of Section 2 of this Amendment shall be
subject to the satisfaction of each of the following conditions precedent:

                  (1)      The Administrative Agent shall have received from the
Company and the Required Lenders a duly executed original (or, if elected by the
Administrative Agent, an executed facsimile copy) of this Amendment.

                                             Second Amendment Agreement (3-Year)

                                       3.

<PAGE>

                  (2)      The Administrative Agent shall have received the
consent of a number of Subsidiaries of the Company satisfactory to the
Administrative Agent, in form and substance satisfactory to the Administrative
Agent, which are Guarantors, parties to a Pledge Agreement or parties to the
Interco Subordination Agreement, in their capacities as such, to the execution
and delivery hereof by the Company.

                  (3)      The Administrative Agent shall have received all
other documents it or the Required Lenders may reasonably request relating to
any matters relevant hereto, all in form and substance satisfactory to the
Administrative Agent.

                  (4)      The representations and warranties in Section 3 of
this Amendment shall be true and correct on and as of the Effective Date with
the same effect as if made on and as of the Effective Date.

         (b)      For purposes of determining compliance with the conditions
specified in Section 4(a), each Lender that has executed this Amendment shall be
deemed to have consented to, approved or accepted, or to be satisfied with, each
document or other matter either sent, or made available for inspection, by the
Administrative Agent to such Lender for consent, approval, acceptance or
satisfaction, or required thereunder to be consented to or approved by or
acceptable or satisfactory to such Lender.

         (c)      From and after the Effective Date, the Credit Agreement is
amended as set forth herein. Except as expressly amended pursuant hereto, the
Credit Agreement shall remain unchanged and in full force and effect and is
hereby ratified and confirmed in all respects.

         (d)      The Administrative Agent will notify the Company and the
Lenders of the occurrence of the Effective Date.

5.       Miscellaneous.

         (a)      The Company acknowledges and agrees that the execution and
delivery by the Administrative Agent, the Lead Arranger and the Lenders of this
Amendment shall not be deemed to create a course of dealing or an obligation to
execute similar waivers or amendments under the same or similar circumstances in
the future.

         (b)      This Amendment shall be binding upon and inure to the benefit
of the parties hereto and thereto and their respective successors and assigns.

         (c)      This Amendment shall be governed by and construed in
accordance with the law of the State of New York (including Sections 5-1401 and
5-1402 of the General Obligations Law of the State of New York); provided that,
the Administrative Agent and the Lenders shall retain all rights arising under
Federal law.

         (d)      This Amendment may be executed in any number of counterparts,
each of which shall be deemed an original, but all such counterparts together
shall constitute but one and the same instrument. Each of the parties hereto
understands and agrees that this document (and any other document required
herein) may be delivered by any party thereto either in the form of an

                                             Second Amendment Agreement (3-Year)

                                       4.

<PAGE>

executed original or an executed original sent by facsimile transmission to be
followed promptly by mailing of a hard copy original, and that receipt by the
Administrative Agent of a facsimile transmitted document purportedly bearing the
signature of a Lender or the Company shall bind such Lender or the Company,
respectively, with the same force and effect as the delivery of a hard copy
original. Any failure by the Administrative Agent to receive the hard copy
executed original of such document shall not diminish the binding effect of
receipt of the facsimile transmitted executed original of such document of the
party whose hard copy page was not received by the Administrative Agent.

         (e)      This Amendment and the other Amendment Documents contains the
entire and exclusive agreement of the parties hereto with reference to the
matters discussed herein. This Amendment supersedes all prior drafts and
communications with respect hereto. This Amendment may not be amended except in
accordance with the provisions of Section 10.01 of the Credit Agreement.

         (f)      If any term or provision of this Amendment shall be deemed
prohibited by or invalid under any applicable law, such provision shall be
invalidated without affecting the remaining provisions of this Amendment, the
Credit Agreement or the Loan Documents.

         (g)      The Company agrees to pay or reimburse Bank of America
(including in its capacity as Administrative Agent) and the Lead Arranger, upon
demand, for all reasonable costs and expenses (including reasonable Attorney
Costs) incurred by Bank of America (including in its capacity as Administrative
Agent) and the Lead Arranger in connection with the development, preparation,
negotiation, execution and delivery of the Amendment Documents.

         (h)      The Company hereby agrees and covenants that within fifteen
(15) Business Days after the Effective Date it will provide to the
Administrative Agent the consent of each Subsidiary of the Company not
previously delivered in accordance with Section 4(a)(2), in form and substance
satisfactory to the Administrative Agent, which is a Guarantor, a party to a
Pledge Agreement or a party to the Interco Subordination Agreement, in their
capacities as such, to the execution and delivery hereof by the Company. The
Company hereby agrees and acknowledges that any failure on its part to comply
with the covenant set forth in the preceding sentence shall be an immediate
Event of Default under the Credit Agreement.

                           [signature pages follow]

                                             Second Amendment Agreement (3-Year)

                                       5.

<PAGE>

                  IN WITNESS WHEREOF, the parties hereto have caused this
Amendment to be duly executed as of the date first above written.

                                        SOLECTRON CORPORATION

                                        By: /s/ Robert Aeschliman
                                            ___________________________________
                                        Name: Robert Aeschliman
                                        Title: Assistant Secretary

                                        BANK OF AMERICA, N.A., AS ADMINISTRATIVE
                                        AGENT AND A LENDER

                                        By: /s/ James Johnson
                                            ___________________________________
                                            Name: James P. Johnson
                                            Title: Managing Director


                                        GOLDMAN SACHS CREDIT PARTNERS L.P.,
                                        AS SOLE LEAD ARRANGER, SOLE BOOK RUNNER
                                        AND CO-SYNDICATION AGENT AND A LENDER

                                        By: /s/ Bruce Mendelsohn
                                            ___________________________________
                                            Authorized Signatory
                                            Name: Bruce Mendelsohn
                                            Title: Authorized Signatory


                                        THE BANK OF NOVA SCOTIA

                                        By: /s/ Kemp Leonard
                                            ___________________________________
                                            Name: Kemp Leonard
                                            Title: Director


                                        BNP PARIBAS

                                        By: /s/ Robert Mimaki
                                            ___________________________________
                                            Name: Robert Mimaki
                                            Title: Vice President

                                        By: /s/ Jean Plassard
                                            ___________________________________
                                            Name: Jean Plassard
                                            Title: Managing Director


                                        CSAM FUNDING II

                                        By: ___________________________________
                                            Name:
                                            Title:

                                             Second Amendment Agreement (3-Year)
                                      S-1.

<PAGE>

                                        THE DEVELOPMENT BANK OF SINGAPORE LTD.,
                                        LOS ANGELES AGENCY

                                        By:  /s/ Wil Kim Long
                                            ___________________________________
                                            Name: Wil Kim Long
                                            Title: General Manager


                                        FLEET NATIONAL BANK, AS L/C ISSUER
                                        AND A LENDER

                                        By: /s/ Greg Roux
                                            ___________________________________
                                            Name: Greg Roux
                                            Title: Director


                                        JPMORGAN CHASE BANK

                                        By: /s/ William Rindfuss
                                            ___________________________________
                                            Name: William Rindfuss
                                            Title: Vice President


                                        MORGAN STANLEY
                                        SENIOR FUNDING, INC.

                                        By: /s/ Mark D. Cross
                                            ___________________________________
                                            Name: Mark D. Cross
                                            Title: Vice President


                                        THE ROYAL BANK OF SCOTLAND PLC

                                        By: ___________________________________
                                            Name:
                                            Title:


                                        STANDARD CHARTERED BANK

                                        By: /s/ Frieda Youlios
                                            ___________________________________
                                            Name: Frieda Youlios
                                            Title: Vice President

                                        By: /s/ Andrew Y. Ng
                                            ___________________________________
                                            Name: Andrew Y. Ng
                                            Title: Vice President
                                            Standard Chartered Bank NY

                                             Second Amendment Agreement (3-Year)


                                      S-2.